This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import threading | |
import os | |
import sys | |
BLOCK_SIZE = 1024*1024 | |
THREADS = 16 | |
def write_range(source, target, start, amount, block_size): | |
with open(source, 'r') as source_file: | |
with open(target, 'r+') as target_file: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
BRANCH_A="$1" | |
shift | |
BRANCH_B="$1" | |
shift | |
PATHS="$@" | |
BRANCH_A_COMMITS=$(mktemp) | |
ONLY_IN_BRANCH_A=$(mktemp) | |
BRANCH_B_COMMITS=$(mktemp) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdio.h> | |
#include <pthread.h> | |
#include <stdlib.h> | |
#include <stdatomic.h> | |
#define CACHELINE__BYTECOUNT (64) | |
struct Data { | |
uint8_t bytes[CACHELINE__BYTECOUNT - 4]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -eu | |
# Similar to git branch --merged but looks at commit author, date and | |
# subject, instead of hash. | |
# | |
# Given branch/ref (e.g. my_branch) and target (e.g. origin/master), | |
# lists commits in branch that have no "equivalent" ones in target (by | |
# author, date and message). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- run it like: | |
-- stack ghc --package criterion -- binary.hs -Wall -O2 && ./binary | |
{-# LANGUAGE FlexibleInstances #-} | |
{-# LANGUAGE BangPatterns #-} | |
module Main where | |
import Data.ByteString.Lazy (ByteString) | |
import Data.Binary | |
import Data.Fixed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*jsl:option explicit*/ | |
"use strict"; | |
// ///////////////////////////////////////////////////////////////////// | |
// // JQUERY EXTENSIONS | |
/* Removed this part.. */ | |
///////////////////////////////////////////////////////////////////// | |
// STRING FORMATTING |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
-- | | |
module Main where | |
import Control.Applicative (Alternative(..), (<|>)) | |
import Data.List (foldl', intercalate) | |
import Data.Monoid ((<>)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// foo :: { 0: Num, 1: Maybe Num } -> Num | |
function foo(a, opt_b) { | |
var b = opt_b == undefined ? 3 : opt_b; | |
return a + b; | |
} | |
// foo here inferred to have this type: | |
// RowFields r Maybe => { 0: Num | r } -> b | |
foo(3); // translated to: foo { 0 = 3 | .. } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foo :: +{ Num : Number, Str : String | r } -> Number | |
function foo(x) { | |
if (typeof x == Number) { .. x is a number here! ...; return 0 } | |
else if (typeof x == String) { .. a string here ..; return 1 } | |
else { .. } | |
} | |
\case x of | |
Num n -> ... ; 0 | |
Str s -> ... ; 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;; This buffer is for notes you don't want to save, and for Lisp evaluation. | |
;; If you want to create a file, visit that file with C-x C-f, | |
;; then enter the text in that file's own buffer. | |
NewerOlder