Skip to content

Instantly share code, notes, and snippets.

View fliphess's full-sized avatar

Flip Hess fliphess

View GitHub Profile
@fliphess
fliphess / .vimrc
Last active January 18, 2024 11:17
Vim config
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"" Load plugin manager
""
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Download vim-plug if not already installed
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
autocmd VimEnter * PlugInstall | source $MYVIMRC
@fliphess
fliphess / reboot_router.py
Last active March 15, 2023 04:27
Reboot Arcadyan VGV7519 (Experia, Telfort NL) through the web interface using python
#!/usr/bin/env python
import getpass
import os
import re
import signal
import sys
from collections import namedtuple
from urllib import urlencode
from urllib2 import build_opener
@fliphess
fliphess / sentry.py
Last active December 13, 2022 20:02
Ansible sentry callback plugin - Send all errors from ansible to Sentry
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import getpass
import logging
import logging.config
import os
import socket
try:
@fliphess
fliphess / migrate-wordpress.sh
Last active October 31, 2022 20:42
Wordpress migrator script
#!/bin/bash
set -e
function die() { echo "$1"; exit 1; }
function action() {
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
echo "@@@ $(date)"
echo "@@@ $1"
echo "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"
@fliphess
fliphess / vnstat-wrapper.php
Created August 31, 2016 13:13
A wrapper around vnstat to view network usage of a server
<?php
header('Pragma: no-cache');
header('Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate, proxy-revalidate');
$domain = $_SERVER["SERVER_NAME"];
$url = $_SERVER["SCRIPT_NAME"];
$options = ['summary', 'hours', 'days', 'months', 'top10'];
$option = filter_input(INPUT_GET, "option", FILTER_SANITIZE_STRING);
@fliphess
fliphess / create-debian-build-environment.sh
Last active August 21, 2021 19:23
Setup an debian build environment with git-pbuilder
#!/bin/bash
# This script installs a basic build environment for debian
ACTION="${1}"
ARGS="${#}"
DEBIAN_VERSION="unstable"
INSTALL_PACKAGES=(
apt-file
cdebootstrap
@fliphess
fliphess / 10-nginx.conf
Last active May 23, 2021 13:29
Custom error pages for nginx ingress controller
################################################################################
## Custom headers forwarded by the nginx ingress controller ##
## ##
## X-Code HTTP status code retuned by the request ##
## X-Format Value of the Accept header sent by the client ##
## X-Original-URI URI that caused the error ##
## X-Namespace Namespace where the backend Service is located ##
## X-Ingress-Name Name of the Ingress where the backend is defined ##
## X-Service-Name Name of the Service backing the backend ##
## X-Service-Port Port number of the Service backing the backend ##
@fliphess
fliphess / wol.py
Created December 21, 2017 15:01
Wake up post 2016 Philips TV's using Wake on Lan
#!/usr/bin/env python3
import struct
import re
import socket
import sys
MAC = '1c:5a:6b:b8:93:c0'
def wake_on_lan(mac):
@fliphess
fliphess / tornado basic auth
Last active February 22, 2020 22:35
basic auth with "htpasswd" file - auth example for tornado webserver
#!/usr/bin/env python
# also check https://gist.github.com/fliphess/7836479
import tornado.ioloop
import tornado.web
import base64
import netaddr
import bcrypt
def require_basic_auth(handler_class):
@fliphess
fliphess / git-browse
Last active February 19, 2020 13:24
Easy visiting gitlab urls from your commandline on Mac OSX
#!/usr/bin/env bash
function usage() {
cat <<EOF
Open current git repo in your browser
Arguments:
--pipe - Show pipeline
--cr - Show container registry
--mr - Show merge requests