Skip to content

Instantly share code, notes, and snippets.


Viktor Petersson vpetersson

Block or report user

Report or block vpetersson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
import pytumblr
import requests
from pprint import pprint
from re import findall
from urlparse import urlparse
tumblr_blog = ''
wordpress_site = ''
source_file = '/Users/mvip/Desktop/pages.txt'
vpetersson / gist:4bb3a87f2af6998332d9
Created Oct 30, 2014
BitTorrent Sync sample config
View gist:4bb3a87f2af6998332d9
"device_name": "My Sync Device",
"listening_port" : 0, // 0 - randomize port
/* storage_path dir contains auxilliary app files if no storage_path field: .sync dir created in the directory
where binary is located. otherwise user-defined directory will be used */
// "storage_path" : "/home/user/.sync",
/* set location of pid file */
// "pid_file" : "/var/run/btsync/",
vpetersson / gist:5df345dbf41197c455f5
Last active Aug 29, 2015
Set up Wordpress with docker
View gist:5df345dbf41197c455f5

Start a MySQL Container

$ docker run -d \
    --name mysql \
    -e MYSQL_ROOT_PASSWORD=mysecretpassword \

Start a WordPress container

vpetersson / gist:3b791362ca5ab581709d
Created Feb 25, 2015
Concat strings in Bash with multiple strings.
View gist:3b791362ca5ab581709d
$ export FOO="One ""Two ""Three"
$ echo $FOO
One Two Three
vpetersson / gist:26472c0a78e78234bad0
Last active Aug 29, 2015
CloudSigma Python util script
View gist:26472c0a78e78234bad0
import requests
import json
import sys
import cloudsigma
import base64
import random
import string
import re
from urlparse import urlparse
from datetime import date
vpetersson / gist:611a62970d0d558bc94e
Created May 21, 2015
APT issue with
View gist:611a62970d0d558bc94e
$ sudo apt-get update
Ign trusty InRelease
Ign trusty-updates InRelease
Hit trusty Release.gpg
Hit trusty-updates Release.gpg
Hit trusty Release
Hit trusty-updates Release
Hit trusty/main Sources
Hit trusty/universe Sources
Hit trusty/main amd64 Packages
View gist:72649771da35458d8b1b

Keybase proof

I hereby claim:

  • I am vpetersson on github.
  • I am 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:

View gist:e97862472ab669d88ed9
CONTAINERS="$(docker ps -a -q)"
if [ -n "$CONTAINERS" ]; then
docker rm "$CONTAINERS"
for i in $(docker images --filter 'dangling=true' -q); do
docker rmi $i;
vpetersson / gist:6654b0579775605ece9c
Created Jul 9, 2015
This is what you can expect from BT Wi-Fi.
View gist:6654b0579775605ece9c
Request timeout for icmp_seq 1176
Request timeout for icmp_seq 1177
64 bytes from icmp_seq=1178 ttl=50 time=589.522 ms
64 bytes from icmp_seq=1179 ttl=50 time=135.608 ms
64 bytes from icmp_seq=1180 ttl=50 time=59.023 ms
64 bytes from icmp_seq=1181 ttl=50 time=89.568 ms
64 bytes from icmp_seq=1182 ttl=50 time=336.301 ms
64 bytes from icmp_seq=1183 ttl=50 time=356.849 ms
64 bytes from icmp_seq=1184 ttl=50 time=136.502 ms
64 bytes from icmp_seq=1185 ttl=50 time=131.593 ms
View gist:ec59baaa583e7e25e86b
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)
You can’t perform that action at this time.