Skip to content

Instantly share code, notes, and snippets.

View sh00tg0a1's full-sized avatar

Chen, Xiao sh00tg0a1

View GitHub Profile
#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@sfan5
sfan5 / cpbitmap2image.py
Created January 6, 2014 10:13
Tools to work with .cpbitmap files
#!/usr/bin/env python2
from PIL import Image
import sys
import struct
def r8(f):
return ord(f.read(1))
if len(sys.argv) <= 2:
print("Usage: %s <input> <output>" % sys.argv[0])
@larsimmisch
larsimmisch / crc64.py
Created April 1, 2014 14:53
crc64 implementation in Python (slow)
from __future__ import print_function
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# (Any use permitted, subject to terms of PostgreSQL license; see.)
# If we have a 64-bit integer type, then a 64-bit CRC looks just like the
# usual sort of implementation. (See Ross Williams' excellent introduction
# A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from
# ftp://ftp.rocksoft.com/papers/crc_v3.txt or several other net sites.)