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
# pip install rpdb | |
import rpdb | |
remote_deb = rpdb.Rpdb('localhost', port = 8000) | |
remote_deb.set_trace() |
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
var hiddenFields = document.getElementsByTagName("input"); | |
var mp3s = []; | |
function getHiddenField(elem, index, collection){ | |
if(elem.getAttribute("type") == "hidden" && (/audio_info\d+_\d+/).test(elem.getAttribute("id"))){ | |
mp3s.push({ | |
'artist': elem.parentElement.nextSibling.nextSibling.childNodes[1].childNodes[0].textContent, | |
'title': elem.parentElement.nextSibling.nextSibling.childNodes[1].childNodes[2].textContent, | |
'url': elem.getAttribute("value").split(",")[0].split('?')[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
""" | |
Physics simulation with PyODE followed by a (basic) rendering with Vapory | |
See the result here: http://i.imgur.com/TdhxwGz.gifv | |
Zulko 2014 | |
This script is placed in the Public Domain (Licence Creative Commons 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
from pycallgraph import PyCallGraph | |
from pycallgraph import Config | |
from pycallgraph import GlobbingFilter | |
from pycallgraph.output import GraphvizOutput | |
class ProfilerMiddleware(object): | |
includes = [] | |
excludes = [] |
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 | |
""" | |
A pure Python "ping" implementation, based on a rewrite by Johannes Meyer, | |
of a script originally by Matthew Dixon Cowles. Which in turn was derived | |
from "ping.c", distributed in Linux's netkit. The version this was forked | |
out of can be found here: https://gist.github.com/pklaus/856268 | |
The versions this script derived from are licensed under GPL v2, this makes | |
mandatory that this is licensed under the same terms as well. If it were up |
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 time | |
import random | |
import select | |
import socket | |
def chk(data): | |
x = sum(a + b * 256 for a, b in zip(data[::2], data[1::2] + b'\x00')) & 0xFFFFFFFF | |
x = (x >> 16) + (x & 0xFFFF) | |
x = (x >> 16) + (x & 0xFFFF) |
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
def hexdump(src, length=16, sep='.'): | |
""" | |
@brief Return {src} in hex dump. | |
@param[in] length {Int} Nb Bytes by row. | |
@param[in] sep {Char} For the text part, {sep} will be used for | |
non ASCII char. | |
@return {Str} The hexdump | |
""" | |
result = [] |
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 | |
# | |
# prevent_syscall_test.py - python-ptrace sample program | |
# | |
# python-ptrace | |
# https://bitbucket.org/haypo/python-ptrace/wiki/Home | |
# | |
# Debian / Ubuntu | |
# $ sudo apt-get install python-ptrace | |
# |
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
# Mostly taken from: http://nbviewer.ipython.org/github/bmcfee/librosa/blob/master/examples/LibROSA%20demo.ipynb | |
import librosa | |
import matplotlib.pyplot as plt | |
# Load sound file | |
y, sr = librosa.load("filename.mp3") | |
# Let's make and display a mel-scaled power (energy-squared) spectrogram | |
S = librosa.feature.melspectrogram(y, sr=sr, n_mels=128) |
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 pyaudio | |
import librosa | |
import numpy as np | |
import requests | |
# ring buffer will keep the last 2 seconds worth of audio | |
ringBuffer = RingBuffer(2 * 22050) | |
def callback(in_data, frame_count, time_info, flag): | |
audio_data = np.fromstring(in_data, dtype=np.float32) |
OlderNewer