Skip to content

Instantly share code, notes, and snippets.

Lukas Lösche lloesche

Block or report user

Report or block lloesche

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
lloesche /
Created Aug 22, 2019
Python coding challenge
#!/usr/bin/env python3
from pprint import pprint
document_uri = ''
def process(document, num_threads=10):
"""Processes a document either found on the local disk or a remote http/https URI
The function reads the document (either from a local file or remote URL) and finds all the http and https URLs in it.
lloesche /
Created Apr 23, 2019
boto short to long region names for use with AWS pricing API
# Get the long region names used by the AWS Pricing API
# There's currently no proper API to do this
# Example:
# print(SHORT_TO_LONG_REGIONS['us-west-2'])
# > US West (Oregon)
from pkg_resources import resource_filename
lloesche /
Last active Feb 7, 2019
Checkout/Pull all repos of a Github organization
set -o errexit -o pipefail
function main {
local num_repos=-1
local page=1
local i
local x
lloesche /
Created May 16, 2018
dump DC/OS pre-cockroachdb IAM data
#!/usr/bin/env python3
import logging
from kazoo.client import KazooClient
zk = KazooClient(hosts='', auth_data=[("digest", "super:xxxxxxxxxx")])
data, stat = zk.get("/bouncer/datastore/data.json")
text_file = open("data.json", "w")
lloesche / test.rb
Last active May 9, 2018
Just a test
View test.rb
#!/usr/bin/env ruby
require 'logger'
STDOUT.sync = true
log =
log.level = Logger::DEBUG
loop do "Hello World"
puts "Hello puts"
STDERR.puts "Hello stderr"
sleep 30
lloesche /
Last active Jun 3, 2019
Backup/Restore DC/OS Services and Jobs from one cluster to another in a suspended state
dcos cluster attach $CLUSTER_A
curl -H "Authorization: token=$(dcos config show core.dcos_acs_token)" $(dcos config show core.dcos_url)/service/marathon/v2/apps | \
jq '.[] | del(.[].version) | del(.[].uri) | del(.[].versionInfo) | del(.[].tasksStaged) | del(.[].tasksRunning) | del(.[].tasksHealthy) | del(.[].tasksUnhealthy) | del(.[].deployments)' > apps.json
for id in $(jq -r '.[] | "\(.id)"' apps.json); do cleanid="${id//\//_}"; jq ".[] | select(.id==\"$id\") | .instances=0" apps.json > service.${cleanid:1}.json; done
lloesche /
Created Apr 17, 2018
Create symlinks for AWS EC2 nvme devices
lloesche / gist:a99e9e487f7bdc3b59c14c2c5ee4a25d
Created Jun 27, 2017
Testing our Github credential leakage scanner
View gist:a99e9e487f7bdc3b59c14c2c5ee4a25d
aws_access_key_id = AKIAJQATOQGMX2TOF1CX
aws_secret_access_key = I3rNML6Nl0vPbh0CuQdqSQ3LB5kHYAaBrWd+VEho
(these are invalid credentials)
View gist:482c72986fd739200a24c22d73b63ce7
FROM alpine:edge
CMD ["Hello World"]
"id": "/marathon-test",
"instances": 1,
"container": {
View Cert with X509v3 extension subjectAltName IP and DNS
# Create your CA crt and key:
openssl req -new -x509 -nodes -newkey rsa:4096 -extensions v3_ca -sha256 -days 3650 -subj "/C=US/ST=CA/L=San Francisco/O=Acme Inc./CN=Acme Insecure Certificate Authority" -keyout ca.key -out ca.crt
chmod 600 ca.key
# Create a CSR:
openssl req -newkey rsa:2048 -nodes -sha256 -keyout cert.key -out cert.csr -subj "/C=US/ST=CA/L=San Francisco/O=Snakeoil Inc./OU=Core/"
# Check contents of CSR (optional):
openssl req -in cert.csr -text -noout
You can’t perform that action at this time.