Skip to content

Instantly share code, notes, and snippets.

View chockenberry's full-sized avatar

Craig Hockenberry chockenberry

View GitHub Profile
@chockenberry
chockenberry / HelloChina.log
Created January 22, 2015 17:23
First traffic from China
183.60.243.240 - - [15/Jan/2015:23:34:10 -0800] "GET / HTTP/1.1" 403 13 "http://www.baidu.com/search/spider.htm" "Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)"
113.224.238.213 - - [15/Jan/2015:23:34:13 -0800] "GET /feeds/api/standardfeeds/GB/most_popular?time=this_week&format=2%2C3%2C9&start-index=1&max-results=10&safeSearch=moderate HTTP/1.1" 403 13 "-" "Android-YouTube/2"
113.224.238.213 - - [15/Jan/2015:23:34:13 -0800] "GET /feeds/api/standardfeeds/GB/recently_featured?format=2%2C3%2C9&start-index=1&max-results=10&safeSearch=moderate HTTP/1.1" 403 13 "-" "Android-YouTube/2"
118.228.30.248 - - [15/Jan/2015:23:34:14 -0800] "GET /file/OYwzhcyF/Power-Puff_Girls_-_Mojo_Jojo_a.htm HTTP/1.0" 403 13 "-" "Python-urllib/1.17"
60.168.38.222 - - [15/Jan/2015:23:34:14 -0800] "GET /announce?info_hash=4%BF%AEy%60f%85M%AA%BD%7BcBk%10%7Ct%2D%AE%C7&peer_id=%2DSD0100%2D%E8V%2C%CE%9F%E39%06e%17%23%CA&ip=192.168.1.101&port=11277&uploaded=8380544196&downloaded=8380544196&left=3255698354&nu

Keybase proof

I hereby claim:

  • I am chockenberry on github.
  • I am chockenberry (https://keybase.io/chockenberry) on keybase.
  • I have a public key whose fingerprint is 2E64 59C9 0BBD C169 3C0F 5C37 8EE0 CB38 3C52 E2F7

To claim this, I am signing this object:

@chockenberry
chockenberry / gist:055bd31f28f3bc5904ea
Last active October 22, 2020 19:24
LAST TIME I WAS IN A PLAY GROUND I GOT BUSTED
typealias BOOLAEN = Bool
typealias LIKEON68K = UInt16
typealias LIKEONPENTIUM = UInt32
typealias STRING = String
typealias STRINGINDEX = String.Index
typealias BOOL = Bool
typealias UNICODESCALER = UnicodeScalar
typealias GONADS = String
typealias NUMBERSWITHDOTS = Double
@chockenberry
chockenberry / gist:85d10a83a924e415ece6
Created October 31, 2014 18:07
xScope Status Items
- (void)createStatusItems
{
const CGFloat itemLength = 22.0f;
NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
if ([userDefaults boolForKey:generalStatusbarSingleItemKey]) {
// create a single status item with a menu to access tools
NSMenu *statusMenu = [[[NSMenu alloc] initWithTitle:@"Status"] autorelease];
#!/bin/sh
find=`find /Applications /Applications/Utilities -maxdepth 2 -name '*.app' -exec echo \{\} \;`
#echo $find
IFS=$'\n'
apps=($find)
total=${#apps[*]}
echo "Checking $total applications..."
echo "The following applications will break in Gatekeeper on 10.9.5 and Yosemite:"
count=0
@chockenberry
chockenberry / gist:11235824
Last active October 22, 2020 19:23
Pipe standard output to a running Cocoa app
1) Create a script named '~/bin/xscope':
#!/bin/sh
parameter=""
if [ -z "$1" ]; then
parameter=`cat /dev/stdin`
else
parameter="$1"
fi
@chockenberry
chockenberry / gist:11056920
Last active October 22, 2020 19:23
NSFont+SystemFont
//
// NSFont+SystemFont.h
// xScope
//
// Created by Craig Hockenberry on 4/17/14.
//
// Thanks to http://nshipster.com/method-swizzling/
#import <Cocoa/Cocoa.h>
To: Phil Schiller <schiller@apple.com>
Subject: Dev Center downtime
Dear Phil,
As I'm sure you're aware, the Mac and iOS Dev Centers have been down for more than a day. This means developers can't:
• Discuss issues in the forums
• Read iOS7 and Mavericks documentation
• Watch WWDC videos
@chockenberry
chockenberry / gist:5469201
Created April 26, 2013 18:09
Unicode trim 2
> var buf_ucs2 = new Buffer([0x35,0xD8,0x9c,0xDC])
undefined
> buf_ucs2.toString('ucs2')
'𝒜'
> var str = buf_ucs2.toString('ucs2')
undefined
> str
'𝒜'
> var buf_utf8 = new Buffer(str, 'utf8')
undefined
@chockenberry
chockenberry / gist:5464387
Created April 26, 2013 00:45
Unicode trim
// Names: HEAVY BLACK HEART <space> EXTRATERRESTRIAL ALIEN <space> FIRE <space> PILE OF POO
// Unicode: U+2764 U+1F47D U+1F525 U+1F4A9
// UTF-8 E2 9D A4 F0 9F 91 BD F0 9F 94 A5 F0 9F 92 A9
> var str = '❤ 👽 🔥 💩'
> str
'❤ 👽 🔥 💩'
undefined
> var buf = new Buffer(str, 'utf8')