Skip to content

Instantly share code, notes, and snippets.

View DavidYKay's full-sized avatar

David Young-Chan Kay DavidYKay

View GitHub Profile
@jboner
jboner / latency.txt
Last active May 5, 2024 03:12
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
@terickson001
terickson001 / main.odin
Last active May 2, 2024 17:40
vulkan-tutorial example in Odin
import "shared:shaderc"
import "vendor:glfw"
import vk "vendor:vulkan"
MAX_FRAMES_IN_FLIGHT :: 2
Context :: struct
{
instance: vk.Instance,
@esperlu
esperlu / mysql2sqlite.sh
Created April 27, 2011 05:46
MySQL to Sqlite converter
#!/bin/sh
# Converts a mysqldump file into a Sqlite 3 compatible file. It also extracts the MySQL `KEY xxxxx` from the
# CREATE block and create them in separate commands _after_ all the INSERTs.
# Awk is choosen because it's fast and portable. You can use gawk, original awk or even the lightning fast mawk.
# The mysqldump file is traversed only once.
# Usage: $ ./mysql2sqlite mysqldump-opts db-name | sqlite3 database.sqlite
# Example: $ ./mysql2sqlite --no-data -u root -pMySecretPassWord myDbase | sqlite3 database.sqlite
@kennethreitz
kennethreitz / mongo.py
Created March 13, 2012 22:54 — forked from lstoll/mongo.py
MongoHQ w/ pymongo on Heroku
import os
import pymongo
MONGO_URL = os.environ.get('MONGOHQ_URL')
if MONGO_URL:
# Get a connection
conn = pymongo.Connection(MONGO_URL)
# Get the database
@alexpw
alexpw / gist:2166820
Created March 23, 2012 04:28
Clojure - macro try-catch
;; Approach 1, verbose
(defmacro try-catch [[lvl-fn fn] body]
(list 'try body
(list 'catch 'Exception 'e
(list lvl-fn 'e
(list ':name (list 'meta '#'fn))))))
(macroexpand '(try-catch [info foo] (reduce + 0 (range 5))))
@DavidYKay
DavidYKay / dualhead-xorg.conf
Last active August 2, 2022 18:25
X11 Config for dual / single screen NVIDIA TwinView.
# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings: version 280.13 (buildd@rothera) Fri Aug 5 12:28:41 UTC 2011
Section "ServerLayout"
Identifier "Layout0"
Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard"
InputDevice "Mouse0" "CorePointer"
Option "Xinerama" "0"
@avescodes
avescodes / Editing Clojure with Emacs
Last active July 5, 2022 13:32
Get started editing Clojure in Emacs with this basic config.
Check out README.md to get started editing Clojure with Emacs.
@bhauman
bhauman / README.md
Last active December 3, 2019 16:43
ClojureScript minimal dev and prod setup.

Recent improvements to the ClojureScript compiler have greatly simplified setting up development versus production outputs.

This example uses Figwheel as something that you want to exclude for production, but the pattern is general.

With this simple setup you only need one html file/view and it will work for developement and production.

@chirag04
chirag04 / Install.md
Last active March 29, 2019 03:49
compile rocksdb as backend for asyncstorage

Credits

All credit to @sahrens for sharing fb's internal implementation.

Setup

  • clone rocksdb from https://github.com/facebook/rocksdb.

  • edit MakeFile inside rocksdb. Search for Platform-specific compilation around line 1122. Make th next few lines to look like this:

ifeq ($(PLATFORM), IOS)
# For iOS, create universal object files to be used on both the simulator and
@leandrosilva
leandrosilva / ClientApp.java
Created June 7, 2012 07:01
My MessagePack-RPC sample: Clojure Server & Java Client
package msgpack.rpc.sample.client;
import org.msgpack.rpc.Client;
import org.msgpack.rpc.loop.EventLoop;
public class ClientApp {
private static class SpawnRequest {
private SpawnRequest(final int clientCount, final int requestCount, final RPCInterface iface) {
new Thread(new Runnable() {
public void run() {