Skip to content

Instantly share code, notes, and snippets.

😎
¯\_(ツ)_/¯

Viktor Petersson vpetersson

😎
¯\_(ツ)_/¯
View GitHub Profile
View gist:8487f45826216f556e89
$ grep -v "^#" /etc/watchdog.conf
max-load-1 = 0.5
realtime = yes
priority = 1
@vpetersson
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 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
View gist:e97862472ab669d88ed9
#!/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;
View gist:72649771da35458d8b1b

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:611a62970d0d558bc94e
Created May 21, 2015
APT issue with ch.archive.ubuntu.com
View gist:611a62970d0d558bc94e
$ sudo apt-get update
Ign http://ch.archive.ubuntu.com trusty InRelease
Ign http://ch.archive.ubuntu.com trusty-updates InRelease
Hit http://ch.archive.ubuntu.com trusty Release.gpg
Hit http://ch.archive.ubuntu.com trusty-updates Release.gpg
Hit http://ch.archive.ubuntu.com trusty Release
Hit http://ch.archive.ubuntu.com trusty-updates Release
Hit http://ch.archive.ubuntu.com trusty/main Sources
Hit http://ch.archive.ubuntu.com trusty/universe Sources
Hit http://ch.archive.ubuntu.com trusty/main amd64 Packages
@vpetersson
vpetersson / gist:f20efe6194460cc28d49
Last active Oct 8, 2019
Parse and dump a sitemap (using Python)
View gist:f20efe6194460cc28d49
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
Inspired by Craig Addyman (http://www.craigaddyman.com/parse-an-xml-sitemap-with-python/)
Enhanced by Viktor Petersson (http://viktorpetersson.com) / @vpetersson
"""
from bs4 import BeautifulSoup
import requests
@vpetersson
vpetersson / gist:6b1da35edbe3f7dc7ca4
Last active Aug 12, 2017
Example on how to create a 'Secret URL' for Nagios in Apache.
View gist:6b1da35edbe3f7dc7ca4
# Example from http://www.screenlyapp.com/use-cases/dashboard/nagios.html
ScriptAlias /cgi-bin/nagios3 /usr/lib/cgi-bin/nagios3
ScriptAlias /nagios3/cgi-bin /usr/lib/cgi-bin/nagios3
Alias /nagios3/stylesheets /etc/nagios3/stylesheets
Alias /nagios3 /usr/share/nagios3/htdocs
<Location /abc123>
# Hard code credentials
AuthBasicFake nagiosadmin nagiosadmin
@vpetersson
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
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
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 \
    mysql

Start a WordPress container

You can’t perform that action at this time.