Skip to content

Instantly share code, notes, and snippets.

Avatar

Sam Kimbrel skimbrel

View GitHub Profile
@skimbrel
skimbrel / silly.java
Created Jul 23, 2015
AWS client code. Ah, yes, the "dispatch async error handler then throw the exception anyway" pattern.
View silly.java
public Future<DeleteMessageBatchResult> deleteMessageBatchAsync(
final DeleteMessageBatchRequest deleteMessageBatchRequest,
final AsyncHandler<DeleteMessageBatchRequest, DeleteMessageBatchResult> asyncHandler)
throws AmazonServiceException, AmazonClientException {
return executorService.submit(new Callable<DeleteMessageBatchResult>() {
public DeleteMessageBatchResult call() throws Exception {
DeleteMessageBatchResult result;
try {
result = deleteMessageBatch(deleteMessageBatchRequest);
} catch (Exception ex) {
View footgun.py
def footgun(f):
@functools.wraps(f)
def wrapper(*args, **kwargs):
if f(*args, **kwargs):
return frobnicate(f(*args, **kwargs))
return wrapper
@footgun
def side_effecting():
View keybase.md

Keybase proof

I hereby claim:

  • I am skimbrel on github.
  • I am skimbrel (https://keybase.io/skimbrel) on keybase.
  • I have a public key whose fingerprint is AD27 EF34 B9F1 96DF 5D34 4151 9F11 A7A8 DECD 30AA

To claim this, I am signing this object:

View gist:9011738
In [1]: import re
In [2]: p = re.compile('foo.*bar')
In [3]: s = 'foo' + 'a' * 2**16 + 'bar'
In [4]: len(s)
Out[4]: 65542
In [5]: p.
View gist:8274813
In [1]: def do_a_nasty(oops=[]):
...: oops.append(3)
...: print oops
...:
In [2]: do_a_nasty()
[3]
In [3]: do_a_nasty()
[3, 3]
View gist:8252008
2079 Safari::Application::tryToTerminateWhenReady() (in Safari) + 323 [0x7fff991a0b09]
+ 2079 -[BrowserApplication tryToTerminate] (in Safari) + 56 [0x7fff991eb2eb]
+ 2079 -[NSApplication terminate:] (in AppKit) + 1604 [0x7fff906bc3e4]
+ 2079 -[NSNotificationCenter postNotificationName:object:userInfo:] (in Foundation) + 68 [0x7fff96a2c4aa]
+ 2079 _CFXNotificationPost (in CoreFoundation) + 2893 [0x7fff91075c5d]
+ 2079 __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ (in CoreFoundation) + 12 [0x7fff91181fcc]
+ 2079 -[AppController _savePendingData:] (in Safari) + 153 [0x7fff9919d1ca]
+ 2079 -[GlobalHistoryObjC savePendingChangesBeforeTermination] (in Safari) + 46 [0x7fff9934cf6c]
+
@skimbrel
skimbrel / large-type.scpt
Last active Dec 31, 2015
a stupid hack to get at alfred's large-type feature from the shell, now with less paste buffer clobbering
View large-type.scpt
on run argv
tell application "Alfred 2"
search item 1 of argv
tell application "System Events"
keystroke "l" using {command down}
end tell
end tell
end run
View gist:7491617
from foo import (bar,
baz,
quux
)
# or
from foo import bar
from foo import baz
from foo import quux
View gist:7457276
$ curl -i https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name=sfmta_muni
HTTP/1.1 400 Bad Request
content-length: 61
content-type: application/json; charset=utf-8
date: Wed, 13 Nov 2013 22:04:41 UTC
server: tfe
set-cookie: guest_id=v1%3A138438028115535261; Domain=.twitter.com; Path=/; Expires=Fri, 13-Nov-2015 22:04:41 UTC
strict-transport-security: max-age=631138519
{"errors":[{"message":"Bad Authentication data","code":215}]}
You can’t perform that action at this time.