Skip to content

Instantly share code, notes, and snippets.

#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@daedalus
daedalus / zeta.c
Created March 8, 2012 23:18
Riemann Zeta Function
#include <stdio.h>
#include <math.h>
double lim(double (*f)(double), double p)
{
double a(int n)
{
if (isinf(p)) {
return pow(2, n);
}
#!/usr/bin/env python
import base64, hashlib, hmac, json, sys, getpass
from Crypto.Cipher import AES
from Crypto.Hash import RIPEMD, SHA256
base58_chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'
def prompt(p):
return getpass.getpass(p + ": ")
@daedalus
daedalus / r.py
Created March 11, 2016 21:32 — forked from wizardofozzie/r.py
r.py
#!/usr/bin/python
#################################################################################
# #
#.______ _______. ______ ___ .__ __. #
#| _ \ / | / | / \ | \ | | #
#| |_) | ______ | (----`| ,----' / ^ \ | \| | #
#| / |______| \ \ | | / /_\ \ | . ` | #
#| |\ \----. .----) | | `----./ _____ \ | |\ | #
#| _| `._____| |_______/ \______/__/ \__\ |__| \__| v0.2.0 #
import datetime
import hashlib
import hmac
import random
import string
import time
import unirest as unirest
key = "da01c7e1f0dc4f166c6aa3d56add3293"
secret = "XXXXXXXXXXXXXXXXXXXXXXXXXX"
@daedalus
daedalus / README.md
Created December 6, 2016 23:57 — forked from mathiasbynens/README.md
Superfish certificate
@daedalus
daedalus / bloom.py
Created March 12, 2017 18:32 — forked from josephkern/bloom.py
A Simple Bloom Filter in Python
#!/usr/bin/env python
"""A simple Bloom Filter implementation
Calculating optimal filter size:
Where:
m is: self.bitcount (how many bits in self.filter)
n is: the number of expected values added to self.filter
k is: the number of hashes being produced
(1 - math.exp(-float(k * n) / m)) ** k
http://en.wikipedia.org/wiki/Bloom_filter
"""
@daedalus
daedalus / min-char-rnn.py
Created March 17, 2017 23:36 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
# Copyright 2014 Chris Cohen
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@daedalus
daedalus / sniffer.py
Created June 9, 2017 01:14 — forked from DTailor/sniffer.py
Raw Socket Sniffer
import socket
from struct import *
s = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_TCP)
while True:
pack = s.recvfrom(20000)
#Get the single element from the tuple