Skip to content

Instantly share code, notes, and snippets.

View hannesbe's full-sized avatar
🏠
Working from home

Hannes Van de Vel hannesbe

🏠
Working from home
View GitHub Profile
@samuel
samuel / check_redis.py
Last active October 19, 2019 11:16
Redis health and memory check for Nagios
#!/usr/bin/python
#
# LICENSE: MIT
#
# Copyright (C) 2014 Samuel Stauffer
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation
@m14t
m14t / fix_github_https_repo.sh
Created July 5, 2012 21:57
Convert HTTPS github clones to use SSH
#/bin/bash
#-- Script to automate https://help.github.com/articles/why-is-git-always-asking-for-my-password
REPO_URL=`git remote -v | grep -m1 '^origin' | sed -Ene's#.*(https://[^[:space:]]*).*#\1#p'`
if [ -z "$REPO_URL" ]; then
echo "-- ERROR: Could not identify Repo url."
echo " It is possible this repo is already using SSH instead of HTTPS."
exit
fi
@NQNStudios
NQNStudios / install-gist-scripts
Last active July 21, 2019 15:59
Manages executable scripts stored in Gists for use on Unix systems.
#!/bin/bash
# First argument: the ID of the Github Gist to clone from
GIST_ID=${1}
# Clone the gist in our bin directory
cd ~/bin
git clone git@gist.github.com:/${GIST_ID}.git
# symlink all scripts for global execution
@zamber
zamber / gen-menu.py
Last active May 21, 2020 15:57
A simple and dirty menu generator for MkDocs. Human sorting, titlecase and automatic numeration.
#!/usr/bin/python
# https://gist.github.com/zamber/af5086cb9c097be5c002
import os
import re
from titlecase import titlecase # pip install titlecase
# Config
root = 'src'
os.chdir(root)
@romgrk
romgrk / dropdown.zsh
Last active December 17, 2017 22:38
# For usage with https://gist.github.com/romgrk/0ba7a864a4e6c76eefd3
# drop-down-terminal gnome extension configuration
# F11/A-F11/C-F11 size-down/medium/up the terminal
# F12 + [0-9] sets background opacity
# F11 & M-F11 = sizeup/sizedown
function _dropdown_h_normal () {
dropdownterminal h 50%
}
anonymous
anonymous / gmailAutoarchive.js
Created January 8, 2017 16:39
function gmailAutoarchive() {
var delayDays = 2; // will only impact emails more than 48h old
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays); // what was the date at that time?
// Get all the threads labelled 'autoarchive'
var label = GmailApp.getUserLabelByName("autoarchive");
var threads = label.getThreads(0, 400);
@hannesbe
hannesbe / pdns-mysql-update-snippets.sql
Last active April 8, 2017 02:37
SQL snippets to bulk update records & soa
/* Update SOA records for zones having a certain IP in the content */
UPDATE records
SET `content` = 'ns1.connexeon.com. domains.connexeon.com. 2017040701 1200 400 1209600 300'
WHERE `id` IN
(SELECT `id`
FROM records_copy
WHERE `type`='SOA'
AND `domain_id` IN
(SELECT DISTINCT `domain_id`
FROM records_copy
@hannesbe
hannesbe / add-connexeon-vpn.ps1
Last active January 31, 2018 17:32
Powershell script to create PPTP VPN Connexeon in Windows, for all users & no additional login required client has joined AD
Add-VpnConnection -Name "VPN Connexeon" -ServerAddress "vpn.connexeon.com" -TunnelType Pptp -EncryptionLevel Required -AuthenticationMethod MSChapv2 -AllUserConnection -RememberCredential -PassThru -UseWinlogonCredential
Set-VpnConnection "VPN Connexeon" -AllUserConnection -SplitTunneling $True
Add-VpnConnectionRoute -ConnectionName "VPN Connexeon" -DestinationPrefix 10.0.0.0/12 -PassThru
Add-VpnConnectionRoute -ConnectionName "VPN Connexeon" -DestinationPrefix 10.111.0.0/16 -PassThru
Add-VpnConnectionRoute -ConnectionName "VPN Connexeon" -DestinationPrefix 10.50.0.0/16 -PassThru
anonymous
anonymous / -
Created September 25, 2017 22:48
System: Host: nuci7-mint18 Kernel: 4.10.0-35-generic x86_64 (64 bit gcc: 5.4.0)
Desktop: Cinnamon 3.4.6 (Gtk 3.18.9-1ubuntu3.3) dm: lightdm Distro: Linux Mint 18.2 Sonya
Machine: Mobo: Intel model: NUC7i7BNB v: J31145-303
Bios: Intel v: BNKBL357.86A.0052.2017.0918.1346 date: 09/18/2017
CPU: Dual core Intel Core i7-7567U (-HT-MCP-) cache: 4096 KB
flags: (lm nx sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx) bmips: 14016
clock speeds: min/max: 400/4000 MHz 1: 3831 MHz 2: 3722 MHz 3: 3770 MHz 4: 3789 MHz
Graphics: Card: Intel Device 5927 bus-ID: 00:02.0 chip-ID: 8086:5927
Display Server: X.Org 1.18.4 drivers: intel (unloaded: fbdev,vesa)
Resolution: 3840x2160@29.98hz
@hannesbe
hannesbe / upgrade-rpi.sh
Last active April 30, 2018 03:17
Update script for RPi (packages + firmware)
#/bin/bash
# Upgrade script for RPi (packages + firmware)
#
# Just run this onliner to launch updates, cleanup & prompt to reboot if required
# bash <(curl -sSL https://connexeon.link/upgrade-rpi)
function needs_reboot {
if [ -f /var/run/reboot-required ]; then
read -p "Restart needed. Reboot? (y/N) " answer;