Skip to content

Instantly share code, notes, and snippets.

def is_zeroed(device_name, buffer_size = 2048):
zero = "\x00"
with open(device_name, "rb") as file:
buffer = file.read(buffer_size)
while buffer != "":
if not all(c == zero for c in buffer):
return False
"PHP IN CONTRAST TO PERL"
This document is http://tnx.nl/php.txt - If you replicate it, please do link.
Trust HTTP headers for last-modified info.
Arguments and return values are extremely inconsistent
------------------------------------------------------
To show this problem, here's a nice table of the functions that match a user
defined thing: (with something inconsistent like this, it's amazing to find
booger:tmp evan$ cat scope.pl
#!/usr/bin/perl
use strict;
if (1) {
my $scoped = 42;
}
print $scoped;
[31m*ESC[1;31m*ESC[0m] A start job is running for /etc/rc....patibility (1min 26s / no limit)^MESC[K[ ESC[31m*ESC[1;31m*ESC[0mESC[31m*ESC[0m] A start job is running for /etc/rc....patibility (1min
27s / no limit)^MESC[K[ ESC[31m*ESC[1;31m*ESC[0mESC[31m* ESC[0m] A start job is running for /etc/rc....patibility (1min 27s / no limit)^MESC[K[ ESC[31m*ESC[1;31m*ESC[0mESC[31m* ESC[0m] A start job
is running for /etc/rc....patibility (1min 28s / no limit)^MESC[K[ESC[31m*ESC[1;31m*ESC[0mESC[31m* ESC[0m] A start job is running for /etc/rc....patibility (1min 28s / no limit)^MESC[K[ESC[1;31m*
ESC[0mESC[31m* ESC[0m] A start job is running for /etc/rc....patibility (1min 29s / no limit)^MESC[K[ESC[0mESC[31m* ESC[0m] A start job is running for /etc/rc....patibility (1min 29s / no limi
t)^MESC[K[ESC[1;31m*ESC[0mESC[31m* ESC[0m] A start job is running for /etc/rc....patibility (1min 30s / no limit)^MESC[K[ESC[31m*ESC[1;31m*ESC[0mESC[31m* ESC[0m] A start job is running for /etc/
rc....patibility (1min 30s /
booger:~ evan$ cat example.yaml
foo: bar
baz:
- one
- two
- 3
booger:~ evan$ cat example.yaml | ruby -ryaml -rjson -e'puts YAML.load(STDIN.read).to_json'
{"foo":"bar","baz":["one","two",3]}
booger:~ evan$ cat example.yaml | ruby -ryaml -rjson -e'puts YAML.load(STDIN.read).to_json'| ruby -ryaml -rjson -e'puts YAML.load(STDIN.read).to_json'
{"foo":"bar","baz":["one","two",3]}
#!/bin/sh
for i in a b c d e f g h i j k l m
do
echo "checking $i"
dig NS @$i.gtld-servers.net. $1 |grep $i|grep NS
done
@eam
eam / cat.rb
Created March 13, 2018 23:57
cat implemented in ruby
#!/usr/bin/env ruby -00
puts DATA.readlines.sample
__END__
;,_ ,
_uP~"b d"u,
dP' "b ,d" "o
d" , `b d"' "b
l] [ " `l, d" lb
# terminal 1
eam@sprat:~$ ruby -e'puts $$; loop {}'
24358
# terminal 2
eam@sprat:~$ gdb -p 24358
gdb> p rb_eval_string("puts 'hello world'")
$1 = 0x8
# terminal 1
typedef int Person;
struct {
void (*bite)(int*);
} *this;
int main(){return 0;};
void makeZombie(Person* you) {
this->bite(you);
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
char buf[4096];
int main() {
int fd;
fd = open("/dev/null", O_WRONLY);
for (int i = 0; i < (1 << 25); i++) {