This file contains hidden or 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 | |
$_h = curl_init(); | |
curl_setopt($_h, CURLOPT_HEADER, 1); | |
curl_setopt($_h, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($_h, CURLOPT_HTTPGET, 1); | |
curl_setopt($_h, CURLOPT_FOLLOWLOCATION, true); | |
curl_setopt($_h, CURLOPT_URL, 'TESTING_URL' ); // Change TESTING_URL on url that you want to test. | |
curl_setopt($_h, CURLOPT_DNS_USE_GLOBAL_CACHE, false ); | |
curl_setopt($_h, CURLOPT_DNS_CACHE_TIMEOUT, 2 ); | |
var_dump(curl_exec($_h)); |
This file contains hidden or 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 | |
subl `git status|grep modified|awk '{ print $3 }'` |
This file contains hidden or 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 | |
for i in $(seq 1 31); do | |
echo $i = `ls -la|grep -c "Jan $i 2013"`; | |
done; |
This file contains hidden or 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 | |
dir=$1 | |
sha=$2 | |
if [[ -z $dir || -z $sha ]] | |
then | |
echo "Usage: $0 otherRepoDir commitSha" | |
exit 1 | |
fi |
This file contains hidden or 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
function cartesian($input) { | |
// http://stackoverflow.com/questions/6311779/finding-cartesian-product-with-php-associative-arrays | |
$result = array(); | |
while (list($key, $values) = each($input)) { | |
// If a sub-array is empty, it doesn't affect the cartesian product | |
if (empty($values)) { | |
continue; | |
} | |
This file contains hidden or 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
-module('counter'). | |
-export([incr/2, get_count/1, loop/1]). | |
loop(Count) -> | |
receive | |
{ incr, Add } -> | |
loop(Count + Add); | |
{ report, To } -> | |
To ! { count, Count }, | |
loop(Count) |
This file contains hidden or 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
-module('sort'). | |
-export([start/0]). | |
start() -> | |
Ctr = spawn_link(counter, loop, [0]), | |
{ok, Data} = getData(), | |
{ok, _Sorted} = sortData(Data, Ctr), | |
counter:get_count(Ctr) . | |
getData() -> |
This file contains hidden or 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
function cartProd(paramArray) { | |
function addTo(curr, args) { | |
var i, copy, | |
rest = args.slice(1), | |
last = !rest.length, | |
result = []; | |
for (i = 0; i < args[0].length; i++) { |
This file contains hidden or 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
(defn cartesian-product | |
"All the ways to take one item from each sequence" | |
[& seqs] | |
(let [v-original-seqs (vec seqs) | |
step | |
(fn step [v-seqs] | |
(let [increment | |
(fn [v-seqs] | |
(loop [i (dec (count v-seqs)), v-seqs v-seqs] | |
(if (= i -1) nil |
This file contains hidden or 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
cartProd = (paramArray) -> | |
addTo = (curr, args) -> | |
rest = args.slice(1) | |
last = not rest.length | |
result = [] | |
i = 0 | |
while i < args[0].length | |
copy = curr.slice() | |
copy.push args[0][i] | |
if last |