Skip to content

Instantly share code, notes, and snippets.

> There's two routes I see to making our system resilient.
There are two routes...
> And of course they nothing in this attack 
And of course they do nothing ...
@derwolfe
derwolfe / server.tac
Created July 31, 2017 00:48
twisted site with HSTS
import os
import pem
from twisted.application.service import Application
from twisted.application.internet import (
TCPServer,
SSLServer
)
@derwolfe
derwolfe / req_bench.py
Last active March 29, 2017 14:26
requests/treq work
from __future__ import print_function
"""
The "tests" here are intended to be used as benchmarks to help in performance
optimization.
"""
from concurrent.futures import ThreadPoolExecutor, ProcessPoolExecutor, as_completed
from time import time
> create table spam(spot inet[]);
> insert into spam values (ARRAY['192.168.1.1'::inet]);
> account_service=> select * from spam;
spot
---------------
{192.168.1.1}
@derwolfe
derwolfe / main.py
Created January 10, 2017 18:00
example of twisted web
from twisted.internet import reactor
from twisted.web.server import Site
from twisted.web.resource import Resource
class Page(Resource):
def render_GET(self, request):
return "hi".encode('utf-8')
"""
Dump current deferred state.
> Anyway, given a tree of deferreds, this will produce a whatever.dot
> file, which can be fed to graphviz' "dot -Tpdf whatever.dot >
> whatever.pdf", >and the pdf has a rather nice-looking graph of the
> deferreds.
http://twistedmatrix.com/pipermail/twisted-python/2012-July/025867.html

Keybase proof

I hereby claim:

  • I am derwolfe on github.
  • I am derwolfe (https://keybase.io/derwolfe) on keybase.
  • I have a public key whose fingerprint is A274 2664 0C95 BAF9 A452 E51C BC97 2703 EE6A 93EC

To claim this, I am signing this object:

@derwolfe
derwolfe / key-cycle-msg.txt
Created August 8, 2016 16:11
gpg key cycle
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512
I am cycling my GPG key.
My old key has fingerprint:
B256 481D 41F3 7AF2 29C2 A3D2 A008 BD38 361C 4770
My new key has fingerprint:
@derwolfe
derwolfe / requirements.txt
Last active March 30, 2016 17:08
klein capture error routes
klein
@derwolfe
derwolfe / foo.clj
Created March 23, 2016 15:00
recorder
cloudpassage-reporter.core> (defn record-my-actions [fn & args]
(str (resolve (quote fn)) " args:" args))
#'cloudpassage-reporter.core/record-my-actions
cloudpassage-reporter.core> (record-my-actions count 1 2 3)
"#'clojure.core/fn args:(1 2 3)”