Skip to content

Instantly share code, notes, and snippets.

View vpetersson's full-sized avatar
😎
¯\_(ツ)_/¯

Viktor Petersson vpetersson

😎
¯\_(ツ)_/¯
View GitHub Profile

Keybase proof

I hereby claim:

  • I am vpetersson on github.
  • I am vpetersson (https://keybase.io/vpetersson) on keybase.
  • I have a public key whose fingerprint is BCF0 4347 27E8 6317 2814 9ACF D8F3 CDB3 DBDA 4D52

To claim this, I am signing this object:

@vpetersson
vpetersson / gist:e97862472ab669d88ed9
Created June 23, 2015 12:00
Docker cleanup script.
#!/bin/bash
CONTAINERS="$(docker ps -a -q)"
if [ -n "$CONTAINERS" ]; then
docker rm "$CONTAINERS"
fi
for i in $(docker images --filter 'dangling=true' -q); do
docker rmi $i;
@vpetersson
vpetersson / gist:6654b0579775605ece9c
Created July 9, 2015 13:54
This is what you can expect from BT Wi-Fi.
Request timeout for icmp_seq 1176
Request timeout for icmp_seq 1177
64 bytes from 216.58.208.78: icmp_seq=1178 ttl=50 time=589.522 ms
64 bytes from 216.58.208.78: icmp_seq=1179 ttl=50 time=135.608 ms
64 bytes from 216.58.208.78: icmp_seq=1180 ttl=50 time=59.023 ms
64 bytes from 216.58.208.78: icmp_seq=1181 ttl=50 time=89.568 ms
64 bytes from 216.58.208.78: icmp_seq=1182 ttl=50 time=336.301 ms
64 bytes from 216.58.208.78: icmp_seq=1183 ttl=50 time=356.849 ms
64 bytes from 216.58.208.78: icmp_seq=1184 ttl=50 time=136.502 ms
64 bytes from 216.58.208.78: icmp_seq=1185 ttl=50 time=131.593 ms
$ grep -v "^#" /etc/watchdog.conf
max-load-1 = 0.5
realtime = yes
priority = 1
vagrant@vagrant-ubuntu-trusty-64:~$ uptime
13:58:19 up 6 min, 1 user, load average: 1.87, 0.88, 0.36
vagrant@vagrant-ubuntu-trusty-64:~$ sudo tail -n 10 /var/log/syslog
Jul 19 13:58:16 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 342 interval(s)
Jul 19 13:58:17 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 343 interval(s)
Jul 19 13:58:17 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 344 interval(s)
Jul 19 13:58:18 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 345 interval(s)
Jul 19 13:58:18 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 346 interval(s)
Jul 19 13:58:19 vagrant-ubuntu-trusty-64 watchdog[1406]: still alive after 347 interval(s)
$ tail -f /var/log/syslog
[...]
Jul 20 08:45:13 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 17 interval(s)
Jul 20 08:45:13 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 18 interval(s)
Jul 20 08:45:14 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 19 interval(s)
Jul 20 08:45:14 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 20 interval(s)
Jul 20 08:45:15 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 21 interval(s)
Jul 20 08:45:15 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 22 interval(s)
Jul 20 08:45:16 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 23 interval(s)
Jul 20 08:45:16 vagrant-ubuntu-trusty-64 watchdog[3831]: still alive after 24 interval(s)
@vpetersson
vpetersson / gist:e9965d8e27aa0a2a71c7
Created August 6, 2015 11:30
logentries_full.crt
-----BEGIN CERTIFICATE-----
MIIERDCCAyygAwIBAgIDAjp4MA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNVBAYTAlVT
MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i
YWwgQ0EwHhcNMTQwODI5MjIyNDU4WhcNMjIwNTIwMjIyNDU4WjBmMQswCQYDVQQG
EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEdMBsGA1UECxMURG9tYWluIFZh
bGlkYXRlZCBTU0wxIDAeBgNVBAMTF0dlb1RydXN0IERWIFNTTCBDQSAtIEc0MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA30GUetr35DFDtuoBG1zOY+r6
baPZau4tmnX51ZxbvTTf2BzJbdgEiNputbe18DCuQNZd+sRTwdQinQROEaaV1UV8
QQVY4Ezd+e5VvV9G3K0TCJ0s5PeC5gcrng6MNKHOxKHggXCGAAY/Lep8myiuGyiL
OQnT5/BFpLG6EWeQVXuP3u04XKHh44PEw3KRT5juHMKAqmSlPoNiHMzgnvhawBMS
@vpetersson
vpetersson / lh_skype.py
Last active September 8, 2015 18:27
Infinite loop to call Lufthansa's customer service line.
import Skype4Py
import random
from time import sleep
"""
A script to keep recalling Lufthansa's customer support until you get through.
You will need Skype4Py installed. I couldn't get it working on Mac OS X, so had
run it in an Ubuntu 14.04 VM.
@vpetersson
vpetersson / burn_screenly_pro.sh
Created January 26, 2016 14:41
An experimental script to burn Screenly Pro's disk image on Mac OS X.
#!/bin/bash
# Replace RELEASEPATH with the path to where you download the disk image
RELEASEPATH="$HOME/Downloads"
SD_DISK=$(mount | grep msdos | awk {'print $1'})
DISK_NO=$(echo $SD_DISK | awk '{print substr($0,length-2,1)}')
RDISK_BASE="/dev/rdisk"
RDISK=$RDISK_BASE$DISK_NO
clear
#!/bin/bash
set -e
RELEASEPATH="$HOME/Downloads/"
SD_DISK=$(mount | grep msdos | awk {'print $1'})
DISK_NO=$(echo $SD_DISK | awk '{print substr($0,length-2,1)}')
RDISK_BASE="/dev/rdisk"
RDISK=$RDISK_BASE$DISK_NO