Skip to content

Instantly share code, notes, and snippets.

View narfdotpl's full-sized avatar

Maciej Konieczny aka narf narfdotpl

View GitHub Profile

Deckset feature request


println("\"Normal\" code.")

@narfdotpl
narfdotpl / private
Created June 11, 2014 12:58 — forked from Ciechan/private
class Counter {
let inc: () -> Int
let dec: () -> Int
init(start: Int) {
var n = start
inc = { ++n }
dec = { --n }
}
Python 2.7.2 (default, Oct 17 2011, 00:04:42)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from dis import dis
>>> def short(xs):
... xs[0] += 1
...
>>> dis(short)
2 0 LOAD_FAST 0 (xs)
3 LOAD_CONST 1 (0)
@narfdotpl
narfdotpl / gist:6568808
Created September 15, 2013 08:09
integer allocation in Python
$ python2.7
Python 2.7.2 (default, Oct 17 2011, 00:04:42)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.1.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> result = None
>>> for n in range(1000):
... m = int(str(n))
... previous_result = result
... result = n is m
... if result != previous_result:
<?xml version="1.0"?>
<root>
<item>
<name>F19 → Backspace/Hyper</name>
<identifier>narfdotpl.hyper</identifier>
<autogen>
__KeyOverlaidModifier__
KeyCode::F19,
@narfdotpl
narfdotpl / gist:5524302
Created May 6, 2013 10:05
good guy git
> g t
git: 't' is not a git command. See 'git --help'.

Did you mean one of these?
    tag
    a
    b
    c
    d

e

@narfdotpl
narfdotpl / gist:5352984
Created April 10, 2013 08:49
GFM italicisation bug

foo foo

(bar) (bar)

(baz ) (baz )

( qux)

@narfdotpl
narfdotpl / votes.py
Last active December 10, 2015 22:28 — forked from mstepniowski/results.txt
#!/usr/bin/env python
# Requirements: requests, lxml, cssselect
import requests
from lxml import html
TALKNAME = "TITLE OF MY AMAZING TALK (it's a secret!)"
COLOR = '\033[1;34m'
END = '\033[0m'
r = requests.get('http://2013.djangocon.eu/vote/')
@narfdotpl
narfdotpl / gist:4336266
Last active December 9, 2015 22:18
CPMA vs OS X

moved to

@narfdotpl
narfdotpl / gist:2036612
Created March 14, 2012 13:50
node wat

EDIT: solved -_-'


Etsy's statsd. Halp.

> node stats.js

/Users/narf/sandbox/statsd/config.js:33

{ graphitePort: 2003, graphiteHost: "localhost", port: 8125 }