This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am sudorandom on github. | |
* I am sudorandom (https://keybase.io/sudorandom) on keybase. | |
* I have a public key ASDYGS5yzBiuY_yTUAPT_vU-PWXPLIPFraUMgmnyvUvyugo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> python -m timeit '["%s" % n for n in range(10000)]' -n 100 | |
100 loops, best of 3: 1.91 msec per loop | |
> python -m timeit '["{}".format(n) for n in range(10000)]' -n 100 | |
100 loops, best of 3: 3.08 msec per loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Based on https://gobyexample.com/rate-limiting | |
package limiters | |
import ( | |
"time" | |
) | |
func NewRateLimiter(rate time.Duration, burst uint) chan time.Time { | |
burstyLimiter := make(chan time.Time, burst) | |
for i := uint(0); i < burst; i++ { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Run Heartbleed for virtual servers | |
for ip in $(sl vm list --format="json" | jq -r .[].primary_ip) | |
do | |
Heartbleed $ip:443 & | |
done | |
# Run Heartbleed for hardware servers | |
for ip in $(sl server list --format="json" | jq -r .[].primary_ip) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
PARSERS = [('pkg_resources', 'parse_version'), ('distutils.version', 'StrictVersion')] | |
def get_parse_fn(): | |
for parser_module, parser in PARSERS: | |
try: | |
return getattr(importlib.import_module(parser_module), 'parser') | |
except ImportError: | |
pass | |
raise Exception("Couldn't find a thing to do the thing") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from suds.client import Client | |
from suds.xsd.doctor import Import, ImportDoctor | |
imp = Import('http://schemas.xmlsoap.org/soap/encoding/') | |
imp.filter.add('http://api.service.softlayer.com/soap/v3/') | |
doctor = ImportDoctor(imp) | |
client = Client('https://api.softlayer.com/soap/v3/SoftLayer_Account?wsdl', doctor=doctor) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
""" | |
Generates graphs of VLANs and connected hardware/CCIs from data in the | |
SoftLayer API. | |
""" | |
import argparse | |
import time | |
try: | |
from pydot import Dot, Node, Edge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SoftLayer.API | |
from pprint import pprint as pp | |
apiUsername = '' | |
apiKey = '' | |
templateId = | |
client = SoftLayer.API.Client('SoftLayer_Product_Order', None, apiUsername, apiKey) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SoftLayer | |
apiUsername = '' | |
apiKey = '' | |
package = 46 | |
client = SoftLayer.Client(username=apiUsername, api_key=apiKey) | |
categoryObjectMask = "mask[isRequired, itemCategory[id, name]]" | |
configurations = client['Product_Package'].getConfiguration( |
NewerOlder