Skip to content

Instantly share code, notes, and snippets.

View LarsKumbier's full-sized avatar

Lars Kumbier LarsKumbier

View GitHub Profile
@LarsKumbier
LarsKumbier / keybase.md
Created April 19, 2014 15:09
Proof of Identity for keybase.io

Keybase proof

I hereby claim:

  • I am LarsKumbier on github.
  • I am larskumbier (https://keybase.io/larskumbier) on keybase.
  • I have a public key whose fingerprint is 61DF 4812 8447 4B95 689B 9DB0 EE73 4042 E4AC D8BA

To claim this, I am signing this object:

userId.auto() __classname__.auto() failedLoginCount.int32() mailValidated.boolean() answers.toTheQuestion.int32() answers.niceBlog.auto()
1 'some-static-string' 0 TRUE -42 'Slate Star Codex'
2 'some-static-string' 2 FALSE -42 'Slate Star Codex'
mongoimport -d db -c users --type tsv --file export.tsv --headerline --columnsHaveTypes
@LarsKumbier
LarsKumbier / check-for-hsts-redirect-loops.py
Created August 13, 2018 10:46
When activating HSTS, all links of a page will be rewritten from http to https upon clicking on them. This might lead to redirect-loops, where an https-page is redirecting to http and back on badly programmed rewrite rules. This script takes a list of urls and checks, if they run into a redirect-loop upon activating HSTS.
from urllib.parse import urlparse
import requests
import sys
MAX_REDIRECTS=8
URL_LIST='urls.txt'
def requestUrl(url, counter=0):
def upgradeUrl(url):
@LarsKumbier
LarsKumbier / update-keys.sh
Created February 15, 2019 10:06
This will update the remote ssh keys and reset the known_hosts file after a redeploy of new machines
#!/usr/bin/env bash
##
## This will update the remote ssh keys and reset the known_hosts file after a redeploy of a new VM
##
## will return the found *.example.com host names from an ansible file
## - alternatively, put your own logic here or give a fixed list:
## HOSTS=( host1.example.com host2.example.de )
HOSTS=( $(grep -o -e "[a-zA-Z0-9\-]*\.example\.com" inventory/heidelberg/inventory) )
@LarsKumbier
LarsKumbier / export.sql
Last active April 16, 2019 03:48
Export Postgresql for mongoimport
COPY (
SELECT
userid AS "userId.auto()",
'some-static-string' AS "__classname__.auto()",
failed_login_count AS "failedLoginCount.int32()",
CASE WHEN mail_validated=TRUE THEN 'TRUE' ELSE 'FALSE' END AS "mailValidated.boolean()",
-42 AS "answers.toTheQuestion.int32()",
'Slate Star Codex' AS "answers.niceBlog.auto()"
FROM
users.accounts
{
"userId" : 1,
"__classname__" : "some-static-string",
"failedLoginCount": 0,
"mailValidated": true,
"answers": {
"toTheQuestion": -42,
"niceBlog": "Slate Star Codex"
}
}