This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Newbie programmer | |
def factorial(x): | |
if x == 0: | |
return 1 | |
else: | |
return x * factorial(x - 1) | |
print factorial(6) | |
#First year programmer, studied Pascal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
double lim(double (*f)(double), double p) | |
{ | |
double a(int n) | |
{ | |
if (isinf(p)) { | |
return pow(2, n); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 + ": ") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# Copyright (c) 2009 Dario Clavijo | |
# | |
# -*- coding: utf-8 -*- | |
# This is the game life http://en.wikipedia.org/wiki/The_Game_of_Life | |
import os, time, random | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# given the x**2-2=0 condition we bruteforce an aproximation to sqrt(2) | |
def sqrt2test(): | |
x = 2 | |
error = 1 | |
step = 0.5 | |
lower_error = 1 | |
i = 0 | |
while (error != 0): | |
i = i + 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
################################################################################# | |
# # | |
#.______ _______. ______ ___ .__ __. # | |
#| _ \ / | / | / \ | \ | | # | |
#| |_) | ______ | (----`| ,----' / ^ \ | \| | # | |
#| / |______| \ \ | | / /_\ \ | . ` | # | |
#| |\ \----. .----) | | `----./ _____ \ | |\ | # | |
#| _| `._____| |_______/ \______/__/ \__\ |__| \__| v0.2.0 # |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# example of proof-of-work algorithm | |
import hashlib | |
import time | |
import random | |
import math | |
max_nonce = 2 ** 32 # 4 billion |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
import socket | |
import struct | |
DNS_QUERY_SECTION_FORMAT = struct.Struct("!2H") | |
DNS_QUERY_MESSAGE_HEADER = struct.Struct("!6H") | |
def decode_question_section(message, offset, qdcount): | |
questions = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import hashlib | |
import hmac | |
import random | |
import string | |
import time | |
import unirest as unirest | |
key = "da01c7e1f0dc4f166c6aa3d56add3293" | |
secret = "XXXXXXXXXXXXXXXXXXXXXXXXXX" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
def readfile(fn): | |
fd = open(fn,'r') | |
r = fd.read() | |
fd.close() | |
return r | |
def writefile(fn,s): |
OlderNewer