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
#!/usr/bin/ruby | |
# | |
# Usage: | |
# ruby ./merge_dna_files.rb file,file1,file2... > merged_file.txt | |
# | |
# Example: | |
# ruby ./merge_dna_files.rb AncestryDNA.txt genome_John_Doe_v4_Full_20170428065226.txt > merged_raw.txt | |
# | |
# Supports 23andMe, AncestryDNA, and Genes for Good 23andMe compatible file formats. | |
# The result will be in 23andMe file format. |
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
git ls-files | xargs -n1 git blame --line-porcelain | sed -n 's/^author //p' | sort -f | uniq -ic | sort -nr |
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
<?php class Sports_Bench_Team_REST_Controller extends WP_REST_Controller { | |
/** | |
* Register the routes for the objects of the controller. | |
*/ | |
public function register_routes() { | |
$namespace = 'sportsbench'; | |
$base = 'teams'; | |
register_rest_route( $namespace, '/' . $base, array( | |
array( |
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
<?php | |
function testPerformance($name, Closure $closure, $runs) | |
{ | |
$start = microtime(true); | |
for (; $runs > 0; $runs--) | |
{ | |
$_ = $closure(); | |
} | |
$end = microtime(true); |
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
/* | |
* dropbox_ext4.c | |
* | |
* Compile like this: | |
* gcc -shared -fPIC -ldl -o libdropbox_ext4.so dropbox_ext4.c | |
* | |
* Run Dropbox like this: | |
* LD_PRELOAD=./libdropbox_ext4.so ~/.dropbox-dist/dropboxd | |
*/ | |
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
<?php | |
/* | |
Run with all available processing power: | |
sudo nice -n -20 php startswith_benchmark.php | sort -h | |
Running with PHP 7.0.7-3 gives: | |
1.6±0.0014 msec - strncmp_startswith_shortcut |
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 | |
if [[ "$2" == "message" || -z "$2" ]]; then | |
BRANCH_NAME=$(git branch 2>/dev/null | grep -e ^* | tr -d ' *') | |
if [[ -n "$BRANCH_NAME" && "$BRANCH_NAME" != "master" ]]; then | |
echo "$BRANCH_NAME: $2 $(cat $1)" > $1 | |
fi | |
fi |