Skip to content

Instantly share code, notes, and snippets.

View antiface's full-sized avatar

A.G. antiface

View GitHub Profile
import requests
r = requests.get('http://gun.io')
print r.content
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@antiface
antiface / gf2.py
Created July 7, 2013 13:34 — forked from fcicq/gf2.py
# GPLv2+, by fcicq
# from http://www.hpl.hp.com/techreports/98/HPL-98-135.pdf
IRRED_COEFF = [
4,3,1,5,3,1,4,3,1,7,3,2,5,4,3,5,3,2,7,4,2,4,3,1,10,9,3,9,4,2,7,6,2,10,9,
6,4,3,1,5,4,3,4,3,1,7,2,1,5,3,2,7,4,2,6,3,2,5,3,2,15,3,2,11,3,2,9,8,7,7,
2,1,5,3,2,9,3,1,7,3,1,9,8,3,9,4,2,8,5,3,15,14,10,10,5,2,9,6,2,9,3,2,9,5,
2,11,10,1,7,3,2,11,2,1,9,7,4,4,3,1,8,3,1,7,4,1,7,2,1,13,11,6,5,3,2,7,3,2,
8,7,5,12,3,2,13,10,6,5,3,2,5,3,2,9,5,2,9,7,2,13,4,3,4,3,1,11,6,4,18,9,6,
19,18,13,11,3,2,15,9,6,4,3,1,16,5,2,15,14,6,8,5,2,15,11,2,11,6,2,7,5,3,8,
3,1,19,16,9,11,9,6,15,7,6,13,4,3,14,13,3,13,6,3,9,5,2,19,13,6,19,10,3,11,
In [40]: A = randLILMatrix(10,10); A.set_type(FF(2))
In [45]: A
Out[45]:
⎡1 mod 2 0 mod 2 0 mod 2 0 mod 2 0 mod 2 1 mod 2 0 mod 2 1 mod 2 0 mod 2 1 mod 2⎤
⎢ ⎥
⎢0 mod 2 1 mod 2 1 mod 2 1 mod 2 0 mod 2 0 mod 2 1 mod 2 0 mod 2 1 mod 2 1 mod 2⎥
⎢ ⎥
⎢1 mod 2 0 mod 2 0 mod 2 0 mod 2 0 mod 2 1 mod 2 1 mod 2 1 mod 2 1 mod 2 0 mod 2⎥
⎢ ⎥
import requests
import lxml
from lxml import html
r = requests.get('http://gun.io')
tree = lxml.html.fromstring(r.content)
elements = tree.get_element_by_id('frontsubtext')
for el in elements:
print el.text_content()
import requests
r = requests.get('http://gun.io')
print r.content
@antiface
antiface / gist:6661000
Created September 22, 2013 15:20 — forked from agiliq/gist:131679
import random
class Markov(object):
def __init__(self, open_file):
self.cache = {}
self.open_file = open_file
self.words = self.file_to_words()
self.word_size = len(self.words)
self.database()
@antiface
antiface / wavegen.py
Created September 28, 2013 14:29 — forked from shen72/wavegen.py
#!/usr/bin/env python
import wave, sys
import numpy as np
import scipy.signal as signal
import math
from mpmath import *
frq_tab = [261.6, 293.6, 329.6, 349.2, 392, 440, 493.8]
from numpy import *
from scipy import *
from matplotlib.pyplot import *
from pylab import *
from numpy.fft import *
import scipy.signal as signal
def mfreqz(b,n,a=1):
""" function to plot the response of a filter"""
figure(n)
# Filtering utilities
import numpy as np
from numpy import pi
from numpy import fft
from scipy import signal
import scipy.signal as sig
import pylab as plt
#### Functions #################