Skip to content

Instantly share code, notes, and snippets.

View corny's full-sized avatar

Julian Kornberger corny

View GitHub Profile
@corny
corny / ssh-multi.sh
Last active October 24, 2019 22:25 — forked from dmytro/ssh-multi.sh
Start multiple synchronized SSH connections with Tmux
#!/bin/bash
# ssh-multi.sh - a script to ssh multiple servers over multiple tmux panes
# usage: type tmux then from inside tmux type ssh-multi.sh HOST1 HOST2 ... HOSTN
# Muayyad Alsadi, D.Kovalov
# https://gist.github.com/muayyad-alsadi/bd25845776bb6b4185ba/
# https://gist.github.com/dmytro/3984680
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# Tested with Ubuntu 16.04 and tmux 2.1
function error() {
@corny
corny / update-hostkeys.sh
Created March 15, 2016 09:06
Update known_hosts file
#!/bin/sh
if [ "$#" = "0" ]; then
echo "missing hosts"
exit 1
fi
for host in $@; do
inet=`dig +short a $host`
inet6=`dig +short aaaa $host`
@corny
corny / sysrc
Created February 18, 2016 15:57
Ansible 2 module for sysrc
#!/usr/bin/env python
from subprocess import Popen, PIPE
def read_var(name):
args = ["sysrc", "-n", "-i", name]
process = Popen(args, stdout=PIPE, stderr=PIPE)
stdout, stderr = process.communicate()
if stderr != "":
@corny
corny / network.go
Last active November 1, 2015 18:31
Calculation of IP subnets in Go
package main
import (
"net"
)
// Calculate a subnet
func (network *net.IPNet) IPSubnet(size int, offset int) *net.IPNet {
var maskLen int
ip := network.IP
@corny
corny / flash-apu1d.sh
Last active October 20, 2015 20:31
Bios update for PC-Engines APU.1D and APU.1D4
#!/bin/sh -e
# use at your own risk!
# `fetch` can be replaced by curl or wget
cd /tmp/
fetch http://www.pcengines.ch/file/apu140908.zip
unzip apu140908.zip
env ASSUME_ALWAYS_YES=YES pkg install flashrom
flashrom --programmer internal -w apu140908.rom -c "MX25L1605A/MX25L1606E"
@corny
corny / convert.py
Last active May 1, 2017 11:53
Places
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import csv
import json
import re
features = []
colors = {
"versorgt": "2c8537",
@corny
corny / dhl-invoice.rb
Last active September 15, 2015 20:02
A hacky script that uses capybara and poltergeist to download invoices from DHL (crappy Oracle ADF Faces application)
#!/usr/bin/env ruby
require 'capybara'
require 'capybara/poltergeist'
Capybara.default_max_wait_time = 5
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app)
end
@corny
corny / apt-upgrade.yml
Created August 11, 2015 23:35
Ansible playbook that uses apt to upgrade packages and remove/purge unneeded packages
---
- hosts: all
environment:
LC_ALL: C
LANG: C
tasks:
- name: Update APT package cache
apt: update_cache=yes cache_valid_time=600
@corny
corny / pc-sysinstall.cfg
Created July 29, 2015 15:10
PC Sysinstall Configuration
# Sample configuration file for an installation using pc-sysinstall
installMode=fresh
installInteractive=no
# Set if we are installing via optical, USB, or FTP
installType=FreeBSD
installMedium=usb
# List our components to install
installComponents=ports
@corny
corny / fix-cpe.sh
Created July 18, 2015 17:48
Fix CPE network for Breminale
uci del network.port2
uci del network.port3
uci del network.port4
uci del network.port5
uci del network.port2_vlan
uci del network.port3_vlan
uci del network.port4_vlan
uci del network.port5_vlan
uci del network.office_vlan
uci set network.wan.ifname=eth0.2