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
# source: http://stackoverflow.com/questions/149057/how-to-removing-trailing-whitespace-of-all-files-recursively | |
find . -not \( -name .svn -prune -o -name .git -prune \) -type f -print0 | xargs -0 sed -i '' -E "s/[[:space:]]*$//" |
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
# stolen from: http://snipt.net/nsmith/restart-audio-os-x/ | |
sudo kill -9 `ps ax | grep 'coreaudio[a-z]' | awk '{print $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
# On OS X, may need to install coreutils | |
# brew install coreutils | |
# | |
# then use gdate instead of date | |
# Convert Unix timestamp to date string | |
date -d @1193144433 | |
# Convert date string to Unix timestamp | |
date -d "2007-10-23 09:00:33" +%s |
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
r --vanilla --slave -e 'x<-c(1,1,1,2,2,3,3,3,3);hist(x)' |
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/env ruby | |
require 'rb-fsevent' | |
require 'open3' | |
ignore_dirs = ['.git', '.hg', '.svn'] | |
def popen cmd | |
Open3.popen3 cmd do |stdin, stdout, stderr| | |
stdout.read.split("\n").each do |line| |
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
--- a/libviews/callgraphview.cpp (revision 1261034) | |
+++ b/libviews/callgraphview.cpp (revision 1261035) | |
@@ -913,7 +913,7 @@ | |
if (s[0] != 'F') | |
return 0; | |
bool ok; | |
- TraceFunction* f = (TraceFunction*) s.mid(1).toUInt(&ok, 16); | |
+ TraceFunction* f = (TraceFunction*) s.mid(1).toULongLong(&ok, 16); | |
if (!ok) | |
return 0; |
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 | |
php -d implicit_flush=off -r "$1"'; for ($i=0; $i<5; $i++) { $t=microtime(true); for ($j=0; $j<100000; $j++) { '"$2"'; } printf("%.6f\n", microtime(true)-$t); }' |
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 nice_number($num, $round=false) { | |
$m = pow(10, floor(log10($num))); | |
if ($m == 0) { | |
return 0; | |
} | |
$f = $num / $m; | |
if ($round) { |
NewerOlder