Skip to content

Instantly share code, notes, and snippets.

// Equivalent C code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
extern char **environ;
int main(int argc, char **argv)
#!/usr/bin/env ruby
#
# I've never liked this behavior in Ruby's Kernel#gets. Run this brief script
# twice:
# ruby gets_makes_me_sad.rb
# That works exactly as expected.
# ruby gets_makes_me_sad.rb file_that_does_not_exist
# At least in the version I am using, the error message has been changed to
# indicate that gets is the culprit. See the documentation for Kernel#gets and
# ARGF for details.
diff --git a/Makefile.am b/Makefile.am
index 38accd4..3dd0956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,10 +10,15 @@ AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = pez
-pez_SOURCES = pez.c pezmain.c pez.h pezdef.h
+pez_SOURCES = pez.c pezmain.c
diff --git a/Makefile.am b/Makefile.am
index 38accd4..3dd0956 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -10,10 +10,15 @@ AUTOMAKE_OPTIONS = foreign
bin_PROGRAMS = pez
-pez_SOURCES = pez.c pezmain.c pez.h pezdef.h
+pez_SOURCES = pez.c pezmain.c
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking for gcc... gcc
checking for C compiler default output file name... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables...
variable algorithm
variable accumulator \ If needed.
: tnpo1
swap 1+ swap
dup 1 <> if
dup 2 /mod swap 0= if nip else drop 3 * 1+ then tnpo1 exit
else drop
then ;
#include <stdio.h>
#include <regex.h>
int main(int argc, char *argv[])
{
regex_t regex;
regmatch_t matches[20];
int i, size;
char errors[4096];
/*
gcc -c compare_short_circuit.c
objdump -d -M intel compare_short_circuit.o
(Skip the "-M intel" part unless on x86 or x86-64.)
*/
int asdf()
{
int a, b, c, d;
d = a | b & c;
return d;
#!/usr/bin/env ruby
def a_proc
proc { return :inside }.call
:outside
end
def a_lambda
lambda { return :inside }.call
:outside
#!/bin/sh
FILENAME="/tmp/...shit.`whoami`"
if [ -f "$FILENAME" ]; then
echo "Please, sir, keep your voice down. You're making a scene."
exit 1
else
echo "Sorry, it's the best I can do."
touch "$FILENAME"
sh -c "sleep 10m; rm $FILENAME" >/dev/null 2>/dev/null&
exit 0