Skip to content

Instantly share code, notes, and snippets.

@DominicImhof
DominicImhof / .htaccess
Last active July 4, 2017 10:51
Save DirCaster Output to feed.xml
DirectoryIndex feed.xml
AddType audio/x-m4a m4a M4A
AddType video/mp4 mp4 MP4
AddType video/x-m4v m4v M4V
AddType audio/mpeg mp3 MP3
AddType audio/playlist m3u M3U
AddType audio/x-scpls pls PLS
AddType application/x-ogg ogg OGG
AddType audio/wav wav WAV
<?php
$roomPrefix = 'doems';
header('Content-type: application/json');
$response = array(
'response_type' => 'in_channel',
'text' => 'https://talky.io/' . uniqid($roomPrefix . '-')
);
@DominicImhof
DominicImhof / digitecOrders.js
Last active March 3, 2017 22:02
Sum digitec Orders
// Bestellungen => https://www.digitec.ch/de/Order
var sum=0;$('.order-box').map(function(){sum+=parseFloat(this.children[4].innerText.replace('\'',''))});console.log(sum);
// Bestellungsarchiv => https://www.digitec.ch/de/OldDigitecOrder/Search/????????
var sum=0;$('.order-box').map(function(){sum+=parseFloat(this.children[5].innerText.replace('\'',''))});console.log(sum);
@DominicImhof
DominicImhof / set_env.sh
Last active May 20, 2016 11:38
set variable in a .env file
PLATFORM=$(uname)
KEY=$1
VAL=$2
# Use awk instead of grep, since grep is not able to handle multiline regex
if [ "$(awk "/^$KEY=.*$/" .env)" != "" ]; then
if [ "$PLATFORM" = "Darwin" ]; then
sed -i '' -E "s~$KEY=.*~$KEY=$VAL~g" .env
else

Keybase proof

I hereby claim:

  • I am dimhof on github.
  • I am dominicimhof (https://keybase.io/dominicimhof) on keybase.
  • I have a public key whose fingerprint is 7E8D F58A D768 D860 D21E CD04 9EE8 C438 919E 411A

To claim this, I am signing this object:

@DominicImhof
DominicImhof / .gitlab-backup
Last active December 20, 2015 16:18
Auto GitLab backup script
REMOTE_HOST=backup4.skilia.ch
REMOTE_USER=backup
REMOTE_PATH=/home/backup/gitlab-backups/
@DominicImhof
DominicImhof / gitit
Last active February 19, 2016 06:05
#!/bin/sh
### BEGIN INIT INFO
# Provides: gitit
# Required-Start: $local_fs $remote_fs $network $syslog $time
# Required-Stop: $local_fs $remote_fs $network $syslog $time
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start or stop Gitit daemon
# Description: Start or stop Gitit daemon
@DominicImhof
DominicImhof / generate-de-authcode.py
Last active May 19, 2016 09:00
Python script to generate .de authcode
#!/usr/bin/python
import random
chars=list('ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz23456789')
code=''
for i in range(8):
code+=random.choice(chars)
print code
@DominicImhof
DominicImhof / google-apps.txt
Created September 7, 2015 15:32
BIND Zonefile for Google Apps MX Records
; Google Apps MX Records
@ 3600 IN MX 10 aspmx.l.google.com.
@ 3600 IN MX 20 alt1.aspmx.l.google.com.
@ 3600 IN MX 30 alt2.aspmx.l.google.com.
@ 3600 IN MX 40 aspmx2.googlemail.com.
@ 3600 IN MX 50 aspmx3.googlemail.com.
@DominicImhof
DominicImhof / database.php
Created October 29, 2013 18:38
Connect Laravel 4 with Redis via UNIX domain sockets
<?php
return array(
'redis' => array(
'cluster' => true,
'default' => array(
'scheme' => 'unix',
'path' => '/tmp/redis.sock'
)
);