Skip to content

Instantly share code, notes, and snippets.

@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 / 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,
@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
#!/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):
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@xyb
xyb / micropythonreference.textile
Last active February 11, 2023 11:04
Micro Python Library Reference
@xyb
xyb / THE PMARCA GUIDE TO STARTUPS.md
Last active July 9, 2023 12:20
Marc Andreessen 的创业指导