Skip to content

Instantly share code, notes, and snippets.

@grodtron
grodtron / jargon.py
Created February 6, 2012 15:54
Better commented jargon bot
from random import random
# triple quotes let you make a multi line string.
d = """Actionable a
Actualize v
Best practice n
Conceptualize v
Cash-neutral a
Cost-centered a
Customer-centered a
@grodtron
grodtron / debug.log
Created February 5, 2012 19:05
nginx debug log for gzip_static request
2012/02/05 18:55:03 [debug] 26882#0: epoll: fd:6 ev:0001 d:00007F62DAF07010
2012/02/05 18:55:03 [debug] 26882#0: accept on 0.0.0.0:57867, ready: 0
2012/02/05 18:55:03 [debug] 26882#0: posix_memalign: 0000000000785350:256 @16
2012/02/05 18:55:03 [debug] 26882#0: *3 accept: 127.0.0.1 fd:3
2012/02/05 18:55:03 [debug] 26882#0: *3 event timer add: 3: 60000:1328468163388
2012/02/05 18:55:03 [debug] 26882#0: *3 epoll add event: fd:3 op:1 ev:80000001
2012/02/05 18:55:03 [debug] 26882#0: timer delta: 37560
2012/02/05 18:55:03 [debug] 26882#0: posted events 0000000000000000
2012/02/05 18:55:03 [debug] 26882#0: worker cycle
2012/02/05 18:55:03 [debug] 26882#0: epoll timer: 60000
@grodtron
grodtron / index.php
Created January 26, 2012 08:32
Test page for something I'm working on
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<title>Test Page</title>
<style type="text/css" media="screen">
*{
@grodtron
grodtron / cb-welcome.py
Created January 23, 2012 17:02
Modification of the Crunchbang Welcome script to run from cron
#!/usr/bin/env python
# cb-fortune
# ----------
# A silly little python script for testing changes to notify-osd settings.
# It kills notify-osd before sending a fortune notification. Requires python-notify & fortune.
import os
#if DISPLAY is not set, then set it to default ':0.0'
if len( os.getenv( 'DISPLAY', '' ) ) == 0:
os.putenv( 'DISPLAY', ':0.0' )
@grodtron
grodtron / .gitignore
Created January 18, 2012 18:00
Modification of Game of Life javascript implementation
*.rle
*.life
embed.js
embed.txt
small.html
@grodtron
grodtron / Makefile
Created December 5, 2011 00:55
Hello world in bash, c, lisp, php and python simultaneously
.PHONY: test
test: helloworld
@gcl -f helloworld.c
@python helloworld.c
@bash helloworld.c
@./helloworld
@php helloworld.c
helloworld: helloworld.c
@grodtron
grodtron / better_quine.py
Created December 3, 2011 06:20
A quick quine in python. The long one I wrote, the short one I found.
print (lambda x:x+repr((x,)))('print (lambda x:x+repr((x,)))',)
@grodtron
grodtron / insertion_sort.c
Created November 26, 2011 20:00
sorting algorithms
void insertion_sort(int data[], int length){
for (int i = 0; i < length; i++) {
for (int j = i; j > 0; --j) {
if(data[j] < data[j - 1]){
swap(data + j, data + j - 1);
}else{
break;
}
}
}
@grodtron
grodtron / plateau.cpp
Created November 16, 2011 15:23
COEN 243 assignment 4
/*
*
* A plateau is a sequence of one or more consecutive occurrences of the same value in an array. For
* instance, the array [3, 7, 7, 9, 5, 2, 2, 2, 7, 5, 5, 1] has the following plateaus [3], [7, 7], [9], [5], [2, 2,
* 2], [7], [5, 5], and [1]. The longest of these is [2, 2, 2]. Write a program that uses pointers to determine
* and print out the longest plateau for a given array. The program should output the lowest and the
* highest subscript of the longest plateau.
*
*/
@grodtron
grodtron / floatBinary.cpp
Created November 14, 2011 15:25
A short program to display the binary representation of a floating point number.
#include <iostream>
using namespace std;
// assumes that sizeof(float) = sizeof(int) = 4 (32 bits)
void showFloatBin(float f){
int n = *((int*) &f); // cast the address of the float f
// to a pointer to an integer and
// then dereference that pointer
// loop through each bit in the float, printing out the