Skip to content

Instantly share code, notes, and snippets.

View jab's full-sized avatar

Joshua Bronson jab

  • 18:58 (UTC -04:00)
View GitHub Profile
## Descriptors
## Anything with __get__ and optionally __set__:
class classinstancemethod(object):
def __init__(self, func):
self.func = func
def __get__(self, obj, type=None):
def repl(*args, **kw):
return self.func(obj, type, *args, **kw)
@jab
jab / index.html
Created August 22, 2014 17:05
<meta> refresh with http-equiv="refsh"
<html>
<head>
<meta http-equiv="refsh" content="0;URL='http://www.example.com/'">
</head>
<body>
<p>Redirecting to <a href="http://www.example.com/">
www.example.com</a>...</p>
</body>
</html>
@jab
jab / index.html
Created August 22, 2014 17:27
meta refresh
<html>
<head>
<meta http-equiv="refresh" content="0;URL='http://www.example.com/'">
</head>
<body>
<p>Redirecting to <a href="http://www.example.com/">
www.example.com</a>...</p>
</body>
</html>
@jab
jab / index.html
Created August 22, 2014 20:11
meta refresh with missing "N;url="
<html>
<head>
<meta http-equiv="refresh" content="http://www.example.com/">
</head>
<body>
<p>Redirecting to <a href="http://www.example.com/">
www.example.com</a>...</p>
</body>
</html>
@jab
jab / index.html
Created August 22, 2014 20:14
meta refresh with missing wait parameter
<html>
<head>
<meta http-equiv="refresh" content=";URL='http://www.example.com/'">
</head>
<body>
<p>Redirecting to <a href="http://www.example.com/">
www.example.com</a>...</p>
</body>
</html>
@jab
jab / factorial.rkt
Last active July 15, 2020 19:44 — forked from lwhjp/factorial.rkt
#lang racket
;;
;; These are some examples of different ways to compute factorials
;; using various paradigms and features provided by Racket. There
;; are more options available in packages which are not imported
;; by default, but that rabbit hole goes very deep indeed.
;;
;; Comments and suggestions welcome!
;; leo@lwh.jp
@jab
jab / keybase.md
Created May 26, 2015 22:56
keybase

Keybase proof

I hereby claim:

  • I am jab on github.
  • I am jab (https://keybase.io/jab) on keybase.
  • I have a public key whose fingerprint is 80E3 76D7 C05A 678C 8A2E 4F52 916D 30D0 8871 6554

To claim this, I am signing this object:

# fetch @patio11's tweets from microconf (roughly apr 3 on)
# signature generated from https://dev.twitter.com/rest/reference/get/statuses/user_timeline
curl --get 'https://api.twitter.com/1.1/statuses/user_timeline.json' --data 'count=200&screen_name=patio11&since_id=717036680947965953' --header 'Authorization: OAuth oauth_consumer_key="x6nmC5cEByCeyudJjVKsMA", oauth_nonce="56b83cf5f068e31996fc484364e99423", oauth_signature="0vY6VEDKTI2Bb8J09osG0yqTA6M%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1460264255", oauth_token="49019793-1cje0xH21w4OsEudjSXTIj1hDQhorGifIrfuBQ0Eb", oauth_version="1.0"' --verbose > tweets.json
# import into postgres
psql -d test -c "CREATE TABLE pgtweets (data json)"
psql -d test -c "COPY pgtweets FROM '$(pwd)/tweets.json'"
# total activity over these 200 tweets
@jab
jab / README.rst
Created June 12, 2016 14:15 — forked from dupuy/README.rst
Common markup for Markdown and reStructuredText

Markdown and reStructuredText

GitHub supports several lightweight markup languages for documentation; the most popular ones (generally, not just at GitHub) are Markdown and reStructuredText. Markdown is sometimes considered easier to use, and is often preferred when the purpose is simply to generate HTML. On the other hand, reStructuredText is more extensible and powerful, with native support (not just embedded HTML) for tables, as well as things like automatic generation of tables of contents.

#lang slideshow
(define (empty-square color [sidelen 70])
(let ([sq (filled-rectangle sidelen sidelen)])
(colorize sq color)))
(let ([colors #("black" "red")])
(for/fold ([rows (blank)]) ([r 8])
(vc-append rows (for/fold ([row (blank)]) ([c 8])
(let* ([idx (remainder (+ c r) 2)]