Skip to content

Instantly share code, notes, and snippets.

@jboner
jboner / latency.txt
Last active December 27, 2024 22:50
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@sqlbot
sqlbot / error.xsl
Last active October 9, 2024 15:18
Rewrite XML error responses from S3 REST endpoints using HAProxy 1.6 and Lua
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!-- This stylesheet will be loaded by the browser, when the Lua script, below -->
<!-- inserts a reference to it in the XML error response from S3. -->
<!-- Place this file in the bucket as /error.xsl -->
<!-- set the Content-Type to text/xsl and make the file public -->
<!-- also you should probably remove this comment block :) -->
<html>
<title>We&#8217;ve encountered a problem</title>
@henrikekblad
henrikekblad / render3Dpcb.jade
Created August 16, 2016 22:54
3D PCB renderer
// Creates an 3d representation of a pcb from bottm and top svg using three.js
// https://www.openhardware.io
// Henrik Ekblad <[email protected]>
//
doctype html
html
head
!= css('main')
base(target="_parent")
block header
@krzysu
krzysu / App.js
Last active February 16, 2022 20:47
how to integrate react-select with react-dnd
import React, { Component } from 'react';
import Select from 'react-select'
import SortableItem from './SortableItem';
import SortableContainer from './SortableContainer';
import update from 'react/lib/update';
const items = [
{ value: '1', label: 'One' },
{ value: '2', label: 'Two' },
{ value: '3', label: 'Three' },
@bansalayush
bansalayush / gist:fa6f28235438592d713ce600fe49c305
Created September 12, 2018 04:38
Install and debug react-native init app without USB!!!!!
1) Connect your mobile device via usb (just this once)
2) Establish a port with your mobile device using 'adb tcpip <port number>'.
eg. adb tcpip 5555
3) Remove USB and 'adb connect <mobile device ip><above mentioned port number>' .
Eg . adb connect 192.160.0.124:5555
4) 'React-native run-android' in your project folder