Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@xyb
xyb / .vimrc
Created August 11, 2014 08:37
python .vimrc, generated from http://vim-bootstrap.appspot.com/
"*****************************************************************************
"" NeoBundle core
"*****************************************************************************
if has('vim_starting')
set nocompatible " Be iMproved
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
@xyb
xyb / httpstub.py
Created September 11, 2014 06:08
a stub http server loading data from current dir
#!/usr/bin/env python
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
import os
PORT_NUMBER = 8080
class HttpStubDirHandler(BaseHTTPRequestHandler):
@xyb
xyb / Perspective: How to pitch your company.md
Last active December 15, 2015 04:10
Perspective: How to pitch your company

SCOTTSDALE, Ariz.--While in the line for the coffee urn at PC Forum, I overheard a young CEO talking about his company.

Apparently, after it became known that Kleiner Perkins Caufield & Byers was interested in investing in the outfit, another venture capital firm, the chief executive said, chartered a private jet to come visit the company to get in on the funding round. "A private jet," he repeated.

The 1990s are back, or at least a shade of them, if you judge by the chatter at the conference here. (PC Forum is owned by CNET Networks, publisher of News.com.)

Two years ago, two young guys with an idea could have more easily raised funds by standing on a bucket and pretending to be robots. Now, investors will fly across the country to discuss doling out cash on the strength of a hunch.

Cat

@xyb
xyb / setup-picnduino-osx.sh
Last active December 15, 2015 11:06
setup PICnDuino on Mac OS X Lion 10.7.5
### Project:
# http://www.bradsprojects.com/electronics/Bradsprojects-PICnDuino.html
# http://www.kickstarter.com/projects/1411349329/picnduino-dual-microcontroller-development-platfor
### Doc:
# http://www.bradsprojects.com/kickstarter/PICnDuinoMacInstructions.pdf
### Download and install:
# http://www.ftdichip.com/Drivers/VCP/MacOSX/ FTDIUSBSerialDriver_v2_2_18.dmg
@xyb
xyb / ohlife_to_nikola.py
Created August 18, 2013 11:17
import ohlife export content to nikola ( https://github.com/ralsina/nikola )
#!/usr/bin/env python
# coding: utf-8
import datetime
import os
import sys
post = ''
prev_date = ''
posts = []
@xyb
xyb / readable_repr.py
Created September 10, 2013 03:28
printing-friendly repr string for CJK characters.
# coding: utf8
import re
REPR_UNICODE_CHAR = re.compile(r'(?<!\\)(\\u[0-9a-f]{4,4})')
def readable_repr(obj):
'''Return printing-friendly unicode string
@xyb
xyb / twister.rb
Created July 7, 2016 03:21
Install twister the p2p microblogging software on mac osx using homebrew
require 'formula'
class Twister < Formula
desc "twister is an experimental peer-to-peer microblogging software."
homepage "http://www.twister.net.co/"
url "https://github.com/miguelfreitas/twister-core/archive/v0.9.34.tar.gz"
sha256 "b250508c7d1c72d1d0dcb2377f65199d1af27e3da9a0f4b4277d818304b101bf"
depends_on "autoconf" => :build
depends_on "automake" => :build
@xyb
xyb / moosefs.rb
Last active July 13, 2016 11:02
Install moosefs on mac osx using homebrew
require "formula"
class Moosefs < Formula
desc "a fault tolerant network distributed file system for petabyte range storage"
homepage "http://moosefs.org/"
url "http://ppa.moosefs.com/src/moosefs-3.0.79-1.tar.gz"
sha256 "f2ddce542c1b2e918060e23e953e220c4a23be982e2bdf214a783f8bac2fb87e"
depends_on "pkg-config" => :build
depends_on "autoconf" => :build
@xyb
xyb / ir_nikon.py
Created June 8, 2013 02:51
Converting IR code of Nikon remote trigger to a wave file.
#!/usr/bin/env python
import sys
from itertools import *
from wavebender import *
def half_wave(frequency=19000, framerate=44100, amplitude=0.5,
skip_frame=0):
for s in sine_wave(frequency, framerate, amplitude,