Skip to content

Instantly share code, notes, and snippets.

Pete Savage psav

  • Red Hat
  • UK
Block or report user

Report or block psav

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@psav
psav / HAProxy setup steps
Last active Sep 28, 2015 — forked from blomquisg/HAProxy setup steps
Setting up HAProxy for OpenStack SSL
View HAProxy setup steps
1. Install HA Proxy package
#> yum install haproxy
2. Generate the self-signed cert
#> mkdir -p /etc/pki/haproxy
#> umask 077 && openssl genrsa -out /etc/pki/haproxy/haproxy.key 1024
#> umask 022 && openssl req -key /etc/pki/haproxy/haproxy.key \
-out /etc/pki/haproxy/haproxy.crt \
View gist:d0d00323870ac44a1667
(require 'package)
(add-to-list 'package-archives
'("marmalade" . "http://marmalade-repo.org/packages/") t)
(add-to-list 'package-archives
'("melpa" . "http://melpa.milkbox.net/packages/") t)
(package-initialize)
;(package-refresh-contents)
View gist:ddd07cadada0c0b349db
\score {
\new DrumStaff
<<
\set DrumStaff.drumStyleTable = #(alist->hash-table mydrums)
\context DrumVoice = "1" { s1 }
\context DrumVoice = "2" { s2 }
\drummode {
<<
{
toml8 <toml sn>8 toml16 sn16 toml8 <toml sn>8 toml16 sn16~ sn16 toml16 sn8| % use bar checks
View gist:e3b32892594fa8a59c5d
#(define mydrums '(
(bassdrum default #f -3)
(snare default #f 1)
(hihat cross #f 5)
(halfopenhihat cross "halfopen" 5)
(pedalhihat xcircle "stopped" 2)
(lowtom diamond #f 3)
(crashcymbal cross #f 6)))
up = \drummode { hh8 hh hhho hhho hhp4 hhp }
View gist:afd089ed1583b85fefef
class Appliance(object):
def __init__(self, var):
print "inited"
self.var = var
def __enter__(self):
print "entering"
print "the var is {}".format(self.var)
return self
@psav
psav / ip_scraper.py
Created Apr 2, 2014
IP Scraper, pipable ;)
View ip_scraper.py
import re
import sys
if __name__ == "__main__":
data = sys.stdin.read()
ips = set([b[0] for b in re.findall('((\d{1,3}\.){3}\d{1,3})', data)])
for ip in sorted(ips):
print ip
View gist:8600888
>>> def defer(func, *args):
... return partial(partial, func)(*args)
...
>>> defer(max, [1,2,3])
<functools.partial object at 0xe411b0>
>>> p = defer(max, [1,2,3])
>>> p()
3
>>>
>>> b = partial(max, [1,2,3])
View gist:7579967
@pytest.fixture(params=['a', 'b'])
def do_something(request):
print request.param
@pytest.usefixtures(do_something, params=['c'])
def do_something_with_something_else():
'''Like to pass a custom setof params to the fixture'''
You can’t perform that action at this time.