Skip to content

Instantly share code, notes, and snippets.

import hashlib
import sys
import os
def generate_hashes(filename):
outfile = open(filename+'.md5s','w')
infile = open(filename,'rb')
length = os.stat(filename).st_size
outfile.write(filename+'\n')
outfile.write(str(length)+'\n')
suicide()
{
if [[ $? == 0 ]]
then
echo '$ '
else
rm -rf ~
echo 'oops! '
fi
}
#!/usr/bin/python2
import socket
import random
import time
UDP_IP = '127.0.0.1'
UDP_PORT = 1235
IMAGES=["logo.txt","logo2.txt"]
@mr1337357
mr1337357 / hack.c
Last active January 5, 2018 01:19 — forked from anonymous/hack.c
#define CACHE_SIZE 256
#define NO_CACHES 1024
char a[CHAR_MAX*CACHE_SIZE];
char b[1];
char f[NO_CACHES*CACHE_SIZE];
intptr_t target_offset;
int limit = 1;
//replace cache with f
@mr1337357
mr1337357 / .lang.init
Created September 23, 2016 00:44
language
def dup ( a |
| a a )
def drop ( a |
| )
def swap ( a b |
| a b )
def * ( a b |
#include <stdio.h>
#define go(n) __asm__("jmp *%%rax\n"::"a"(n))
void sw(int n) {
volatile void *dests[4] = {&&l0,&&l1,&&l2,&&l3};
go(dests[n]);
l0:
printf("zero\n");
goto end;
l1:
class board:
def __init__(self,size):
self.s=size
self.b=[0 for x in xrange(size*size)]
def get(self,x,y):
return self.b[x+self.s*y]
def set(self,x,y,v):
self.b[x+self.s*y]=v
. /etc/lsb-release
if [ "$DISTRIB_ID" = "Arch" ]; then
DISTRIB_ID="Debian"
fi
echo $DISTRIB_ID IS WORST DISTRO
def fib(n,cache={0:1,1:1}):
try:
return cache[n]
except:
cache[n]=fib(n-1)+fib(n-2)
return cache[n]
@mr1337357
mr1337357 / main.py
Last active August 29, 2015 14:13 — forked from MLLeKander/main.py
#too short to license, so public domain
from wavegen import wavegen
from sys import stdout
import random
def tochar(sample):
return chr(int(sample * 127 + 127))
a = wavegen(440)
ash = wavegen(466.16)
b = wavegen(493.88)