This file contains hidden or 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 urllib2 | |
import os | |
import json | |
URL = 'http://hastebin.com/documents' | |
def run(*args): | |
if args: |
This file contains hidden or 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
#!/bin/bash | |
server='hastebin.com'; | |
usage="$0 pastes into $server | |
usage: $0 something | |
example: '$0 pie' or 'ps aufx |$0'" | |
if [ -z $1 ]; then | |
str=`cat /dev/stdin`; |
This file contains hidden or 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
# aptitude install qemu-kvm libvirt-bin | |
# create a bridge with your current interface | |
auto eth1 | |
iface eth1 inet manual | |
auto br0 | |
iface br0 inet dhcp | |
bridge_ports eth1 |
This file contains hidden or 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
Why do compilers even bother with exploiting undefinedness signed overflow? And what are those | |
mysterious cases where it helps? | |
A lot of people (myself included) are against transforms that aggressively exploit undefined behavior, but | |
I think it's useful to know what compiler writers are accomplishing by this. | |
TL;DR: C doesn't work very well if int!=register width, but (for backwards compat) int is 32-bit on all | |
major 64-bit targets, and this causes quite hairy problems for code generation and optimization in some | |
fairly common cases. The signed overflow UB exploitation is an attempt to work around this. |
This file contains hidden or 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
CFLAGS=-Wall -g | |
clean: ## Clean directory | |
rm -f *.o | |
help: ## Help target | |
@ag '^[a-zA-Z_-]+:.*?## .*$$' --nofilename $(MAKEFILE_LIST) \ | |
| sort \ | |
| awk 'BEGIN{FS=": ## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' |
This file contains hidden or 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) |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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) |