Skip to content

Instantly share code, notes, and snippets.

Avatar

Jan Koppe JanKoppe

View GitHub Profile
@JanKoppe
JanKoppe / gist:96dc92564f223e86e21e28a66523518b
Last active Apr 15, 2020
ugly POC to get billable seconds per project for a gitlab runner from the api
View gist:96dc92564f223e86e21e28a66523518b
import gitlab
from datetime import datetime, timedelta
import dateutil.parser
import pytz
import pprint
import os
BILLING_PERIOD_DAYS=7
@JanKoppe
JanKoppe / README.md
Last active Dec 9, 2019
36C3: Pretalx XML filter out track
View README.md
@JanKoppe
JanKoppe / 1001.conf
Created Jul 2, 2019 — forked from blha303/1001.conf
Asterisk 1.0.0.1 context
View 1001.conf
[1001]
exten => _X.,1,Set(CALLERID(name)=1.0.0.1)
exten => _X.,n,Answer
exten => _X.,n,Wait(1)
exten => _X.,n,Playback(1001-recordtype) ; "Enter record type on your phone keypad, followed by the hash key. Press 1 to go to next character"
exten => _X.,n,Read(recordtype,,,si,)
exten => _X.,n,Playback(1001-domain) ; "Enter domain name to retrieve record, followed by the hash key"
exten => _X.,n,Read(domain,,,si,)
exten => _X.,n,Set(RECORD="${SHELL(/usr/bin/1001.py "${recordtype}")}")
exten => _X.,n,Set(ADDR="${SHELL(/usr/bin/1001.py "${domain}")}")
@JanKoppe
JanKoppe / group_vars_all.ayml
Created May 27, 2019
Ansible Templating issue
View group_vars_all.ayml
test:
multiline: |
f4x6aaBtLPQk898Ymfkn
TQsi69wDY40aluFbdp99
jqdGOkx9CN2xgWOM8JeI
M4lXnXyctLTDejDb2eZu
XBPmvqXJStQFZIQwHzLF
by0cxOYjrY3On6hj3oqk
Xu0Ze6Sz8EbC7udHsyxE
jNv0M7lWNJCfegOlDCJH
@JanKoppe
JanKoppe / .gitignore
Created May 2, 2019 — forked from smoser/.gitignore
cloud-init ubuntu nocloud example with network config
View .gitignore
*.img
*.raw
@JanKoppe
JanKoppe / howToModifyOvaFile.md
Created May 2, 2019 — forked from goodjob1114/howToModifyOvaFile.md
how to modify .ova file on linux/Mac using terminal....export vm (OVF 1.0) from virtualbox, then modify some tag and hash value for import vm to ESXi
View howToModifyOvaFile.md

extract ova files from an archive

$ tar -xvf vmName.ova

modify ovf for some invalid tag

$ vi vmName.ovf
View better-ssh-authorized-keys-management.md

Better SSH Authorized Keys Management

A seemingly common problem that people encounter is how to handle all of your users authorized_keys file.

People struggle over management, ensuring that users only have specific keys in the authorized_keys file or even a method for expiring keys. A centralized key management system could help provide all of this functionality with a little scripting.

One piece of functionality overlooked in OpenSSH is the AuthorizedKeysCommand configuration keyword. This configuration allows you to specify a command that will run during login to retrieve a users public key file from a remote source and perform validation just as if the authorized_keys file was local.

Here is an example directory structure for a set of users with SSH public keys that can be shared out via a web server:

@JanKoppe
JanKoppe / clock.py
Last active Dec 28, 2018
Chaos-West Fahrplan quick overview/clock
View clock.py
import requests
import time
import icalendar
import datetime
import pytz
from colored import fg, bg, attr
def loopme():
r = requests.get('https://fahrplan.chaos-west.de/35c3chaoswest/schedule/export/schedule.ics')
View hetzner.tf
variable "hcloud_token" {
}
provider "hcloud" {
token = "${var.hcloud_token}"
}
resource "hcloud_server" "kube-master" {
name = "kube-master"
image = "ubuntu-18.04"
@JanKoppe
JanKoppe / remindme.sh
Created Jul 30, 2018
remindme script
View remindme.sh
#!/bin/bash
# Reminds you in xx minutes with notify-send, using at/atd
MINUTES=${1}
MESSAGE=${2:-reminder}
at now + "${MINUTES}" minutes << EOF
notify-send -c reminder -u critical 'Reminder from ${MINUTES} minutes ago' '${MESSAGE}'
EOF
You can’t perform that action at this time.