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 | |
while (true) { | |
fprintf(STDERR, '/*php*/ '); | |
$filename = tempnam('', 'php-repl-'); | |
file_put_contents($filename, array("<?php\n", fgets(STDIN))); | |
require_once $filename; | |
unlink($filename); | |
} |
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
unlink($argv[1]); | |
$ii = count(explode("/", $argv[1])) - 2; | |
for ($i = 0; $i < $ii; ++$i) { | |
if (!@rmdir($argv[1] = dirname($argv[1]))) { break; } | |
} |
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
# Fake RubyGems | |
# http://gist.github.com/223216 is an expansion of Chris' | |
# http://gist.github.com/157899 that allows Rails to work properly | |
module Rip | |
module Commands | |
FAKE_RUBYGEMS = <<EOM | |
require 'thread' | |
def gem(name, *args) | |
raise LoadError if name =~ /adapter$/ | |
raise Gem::LoadError unless name =~ /^rails|rack$/ |
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/sh | |
sysctl -w kern.maxproc=2048 | |
sysctl -w kern.maxprocperuid=1024 | |
echo kern.maxproc=2048 >>/etc/sysctl.conf | |
echo kern.maxprocperuid=1024 >>/etc/sysctl.conf | |
echo limit maxproc 1024 2048 >>/etc/launchd.conf |
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
$ # Bad | |
$ | |
$ php -r 'echo date("r", strtotime("-1 month", strtotime("2009-12-31"))), "\n";' | |
Tue, 01 Dec 2009 00:00:00 +0000 | |
$ | |
$ php -r 'echo date("r", strtotime("-1 month", strtotime("2009-11-30"))), "\n";' | |
Fri, 30 Oct 2009 00:00:00 +0000 | |
$ | |
$ | |
$ |
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
/* Print the pointer size as seen by gcc. */ | |
#include <stdio.h> | |
int main(int argc, char **argv) { | |
printf("%d\n", 8 * sizeof(void *)); | |
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
$ python -c 'import errno, sys; print(errno.errorcode[int(sys.argv[1])])' 17 | |
EEXIST | |
$ python -c 'import errno, sys; print(errno.errorcode[int(sys.argv[1])])' 2 | |
ENOENT | |
$ |
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
(master) root@devbox:~/play/chefplay# pwd | |
/root/play/chefplay | |
(master) root@devbox:~/play/chefplay# cat solo.rb | |
file_cache_path "/root/play/chefplay/file-cache" | |
cookbook_path "/root/play/chefplay/file-cache/cookbooks" | |
(master) root@devbox:~/play/chefplay# ls -l file-cache/cookbooks/ | |
total 0 | |
lrwxrwxrwx 1 root root 32 Jan 24 00:05 build-essential -> ../all-cookbooks/build-essential | |
lrwxrwxrwx 1 root root 22 Jan 24 05:17 rails -> ../all-cookbooks/rails | |
lrwxrwxrwx 1 root root 21 Jan 24 05:04 ruby -> ../all-cookbooks/ruby |
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/gem --version | |
1.3.5 | |
$ /usr/bin/gem unpack .rip/rip-packages/clint-683c264115582cf6d2be53b01a12f0ed.gem --target=/home/rcrowley/.rip/rip-packages | |
Unpacked gem: '/home/rcrowley/.rip/rip-packages/clint-683c264115582cf6d2be53b01a12f0ed' | |
$ | |
$ gem --version | |
1.3.6 | |
$ gem unpack .rip/rip-packages/clint-683c264115582cf6d2be53b01a12f0ed.gem --target=/home/rcrowley/.rip/rip-packages | |
ERROR: While executing gem ... (Gem::FilePermissionError) | |
You don't have write permissions into the /opt/ruby-1.8.7/lib/ruby/gems/1.8 directory. |
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
require 'fresher' | |
use Fresher | |
require 'myapp' | |
run MyApp |