Skip to content

Instantly share code, notes, and snippets.

View rafkhan's full-sized avatar
😳
im ok

Rafael Khan rafkhan

😳
im ok
View GitHub Profile
@rafkhan
rafkhan / josh_sucks.py
Last active December 10, 2015 17:58
JOSH SUCKS
import os
os.chdir("src")
for fl in filter(lambda f: os.path.isfile(f), os.listdir("./")):
print("Compiling: " + fl)
os.system("lessc " + fl + " > ../css/" + fl[:-5] + ".css")
@rafkhan
rafkhan / 1.py
Last active December 11, 2015 00:58
a = input("w: ")
b = input("h: ")
print a * b
from __future__ import print_function
import sys
from xlrd import open_workbook
wb = open_workbook('EligibleUSmemberForTAworkshop.xlsx')
values = []
for s in wb.sheets():
for row in range(s.nrows):
values.append(s.cell(row, int(sys.argv[1])).value)
@rafkhan
rafkhan / worst-collatz-ever.py
Created April 27, 2013 22:37
Saw this on /g/
n = 1
sent = 1
def n_divide():
global n
n = (n/2)
def n_add():
global n
n = ((3 * n) + 1)
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.out.println("Hello world");
}
});
@rafkhan
rafkhan / SPOILER
Created June 4, 2013 22:17
SPOOOOILERS
X is an array of size 3 in which each element is a pointer to a function that takes no arguments and returns a pointer to a character array of size 5.
@rafkhan
rafkhan / piller.c
Created June 6, 2013 07:19
Garbage summative assignment.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* file_to_string(FILE *fp);
int count_delim(char *str);
void tokenize(int *indices, char *str);
void isort(int* arr, int len);
#define F(x) void func_##x() {printf("In function %d\n",x);}
/*
* The only requirement for running the program,
* is that the input file is terminated by a ','
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
char* file_to_string(FILE *fp);
@rafkhan
rafkhan / recursive_fib.py
Last active December 18, 2015 19:19
eat it, jackson
def fib(a,b):
print a;
if a < 100:
fib(b, a + b)
return
else:
return
return
@rafkhan
rafkhan / gist:5833615
Created June 21, 2013 19:18
god damnit PHP
RNode Object ( [action:RNode:private] => Closure Object ( ) [children:RNode:private] => Array ( [menu] => RNode Object ( [action:RNode:private] => Closure Object ( ) [children:RNode:private] => Array ( [item] => RNode Object ( [action:RNode:private] => [children:RNode:private] => [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args] => ) ) [children:RNode:private] => [var_child:RNode:private] => ) ) ) [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args] => ) ) [children:RNode:private] => [var_child:RNode:private] => ) ) [json] => RNode Object ( [action:RNode:private] => [children:RNode:private] => Array ( [menu] => RNode Object ( [action:RNode:private] => [children:RNode:private] => Array ( [item] => RNode Object ( [action:RNode:private] => [children:RNode:private] => [var_child:RNode:private] => RNode Object ( [action:RNode:private] => Closure Object ( [parameter] => Array ( [$args