Skip to content

Instantly share code, notes, and snippets.

@jomat
jomat / Gelduebergabelogsummarizer.sh
Last active September 28, 2015 18:57
Gelduebergabelogsummarizer
#!/bin/zsh
# save a | separated list in the TABLE_FILE
# i. e:
# | 02dec2011 21:23 | 5 | matemat | jomat |
# | 02dec2011 21:42 | 20 | matetjunkie | jomat | Direktverkauf 20 Stueck 1-Euro-Mate |
# | 05dec2011 20:23 | 46.6 | matemat | jomat |
# and run me
TABLE_FILE=/tmp/kohlen
@jomat
jomat / make_sandwich.sh
Created December 17, 2011 14:17
Script for our sandwichmaker
#/bin/zsh
# v0.1 jomat 2011-12-16 created makefile
# v0.2 ssc 2011-12-17 added toilet infos
# v0.3 sepi 2011-12-17 outsourced to shell script, catches ctrl_c
# v0.4 ssc 2011-12-17 added 2min user timeout and speech stuff (speak,shout)
#jmt learn to readable code :)
trap ctrl_c INT
@jomat
jomat / ypd².sh
Created December 20, 2011 01:52
youporn-deutsch.com downloader
#!/bin/zsh
# ./ypd².sh http://youporn-deutsch.com/video/2961/schneeflittchen-2
# ./ypd².sh http://youporn-deutsch.com/video/2720/dornm%C3%B6schen
foo=(`echo $1|cut -d/ -f5,6|sed 'su/u u'`)
foo[2]=$(printf "`echo $foo[2]|sed 's/+/ /g;s/%/\\\\x/g'`")
echo video id: $foo[1]
echo file name: $foo[2]
@jomat
jomat / 420
Last active February 21, 2018 12:14
#! /usr/bin/env python
import pytz, datetime
now_utc = datetime.datetime.utcnow()
now_utc = pytz.utc.localize(now_utc)
for tzstring in pytz.all_timezones:
local_tz = pytz.timezone(tzstring)
local_time = now_utc.astimezone(local_tz)
@jomat
jomat / sslarm
Last active April 28, 2016 22:41
#!/bin/zsh
function retr_cert_base64() {
fields=(${(s: :)1})
host=$fields[1]
port=$fields[2]
sni=$fields[3]
proto=$fields[4]
[ -z "$sni" ] && servername=$host || servername=$sni
[ -n "$proto" ] && starttls="-starttls $proto"
@jomat
jomat / alpine_chroot.sh
Created October 5, 2016 11:02
Creates an alpine linux chroot
#!/bin/sh
set -xeu
arch=x86_64
base_dir=/data/opt/alpine
work_dir=${base_dir}/work-${arch}
chroot_dir=${base_dir}/edge-${arch}
version=2.6.7-r1
mirror=http://dl-2.alpinelinux.org/alpine/
#!/bin/bash
user=
pass=
url=
echo $*
case $1
in
###
# Copyright (c) 2016, Johannes Matheis
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions, and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright notice,
@jomat
jomat / update_riot.sh
Last active June 22, 2019 11:16
Script to check latest riot-web release and update it
#!/bin/zsh
# This script assumes you have a symlinked riot installation, eg
# /var/www/html/riot -> /var/www/html/riot-v0.11.4
#
# If the local version is older than the github version, it
# downloads the latest release, extracts it, copies
# config.json and home.html from old to new, removes
# the old symlink and sets a new one
#!/usr/bin/env python3
import requests
from requests.compat import urljoin
AS_TOKEN = "redacted"
HS_BASE = "https://darkfasel.net"
ROOMS = [
"!someroomid:darkfasel.net"
]