Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
set -e
IMAGESIZE="990" # in Megabytes
USERNAME="bill"
PASSWORD="b0ard"
PACKAGES="wireless-tools xinit consolekit net-tools fonts-freefont-ttf ifplugd ifupdown hostname fontconfig-config fontconfig iputils-ping wpasupplicant curl binutils locales sudo openssh-server ntp usbmount patch less rsync sudo raspi-config matchbox chromium x11-xserver-utils xwit sqlite3 libnss3 vim"
PI_HOSTNAME=${PI_HOSTNAME-"dashboard${RANDOM:0:3}"}
# Print some configurations
@dirkakrid
dirkakrid / create_keys
Created December 6, 2016 07:08 — forked from mikemackintosh/create_keys
Used to generate max-length SSH keys for TMate
#!/bin/bash
gen_key() {
bits=4096
keytype=$1
ks="${keytype}_"
key="keys/ssh_host_${ks}key"
if [ ! -e "${key}" ] ; then
if [ "${keytype}" = 'dsa' ] ; then
bits=1024
elif [ "${keytype}" = 'ecdsa' ] ; then
@dirkakrid
dirkakrid / check.sh
Created December 6, 2016 07:10 — forked from mikemackintosh/check.sh
Validate x509 (SSL) Certs and Keys using Modulus
for i in `ls -1 *.key`; do
cert=`echo $i |sed -e 's/\.key//'`;
c=$((\
openssl x509 -noout -modulus -in "${cert}.crt" 2>/dev/null| \
openssl md5; \
openssl rsa -noout -modulus -in "${cert}.key" 2>/dev/null| \
openssl md5)\
|uniq \
|wc -l);
test $c -gt 1 && \
PID=$(ps aux |\
grep `w | \
grep -E "\s(tty.*?|console.*?)\s" | \
awk '{print $2}'` | \
grep -v "grep" | \
awk '{print $2}')
@dirkakrid
dirkakrid / command.sh
Created December 6, 2016 07:16 — forked from mikemackintosh/command.sh
openssl_speed.sh
openssl speed rsa
@dirkakrid
dirkakrid / firewall-start
Created December 6, 2016 07:54 — forked from mikemackintosh/firewall-start
Asus Router Firewall
#!/bin/sh
##################################################################################################
## 01/01/2015 --- RT-AC56U / RT-ACRT66U / RT-AC68U Firewall Addition v0.7.6 #
##################################################################################################
### ----- Make Sure To Edit The Following Files ----- #
### /jffs/scripts/firewall <-- Blacklists IP's From /tmp/home/root/ipset.txt #
### /jffs/scripts/ipset.txt <-- Banned IP List/IPSet Rules #
##################################################################################################
##############################
@dirkakrid
dirkakrid / bash
Created December 6, 2016 08:00 — forked from mikemackintosh/bash
Python Pygments and colored cat output
sudo easy_install Pygments
alias cat='pygmentize -O console256 -g'
@dirkakrid
dirkakrid / ncclient_demo.py
Created December 7, 2016 05:38 — forked from jeffbrl/ncclient_demo.py
Executing Arbitrary Junos 'Show' Commands with PyEZ and ncclient
#!/usr/bin/env python
# Demonstrates the use of the 'command' tag to execute arbritrary 'show' commands.
# This code was inspired by Ebben Aries's command-jnpr.py at
# https://github.com/leopoul/ncclient/blob/master/examples/juniper/command-jnpr.py
#
# usage: python ncclient_demo.py <show command> <xpath expression>
# python ncclient_demo.py 'show route 2600::/64' '//rt-entry/nh'
#
# Jeff Loughridge
# August 2014
@dirkakrid
dirkakrid / python27_on_centos65.md
Created December 13, 2016 01:24 — forked from dalegaspi/python27_on_centos65.md
Installing Python 2.7 on CentOS 6.5

Installing Python 2.7 on Centos 6.5

Centos 6.* comes with Python 2.6, but we can't just replace it with v2.7 because it's used by the OS internally (apparently) so you will need to install v2.7 (or 3.x, for that matter) along with it. Fortunately, CentOS made this quite painless with their Software Collections Repository

sudo yum update # update yum
sudo yum install centos-release-scl # install SCL 
sudo yum install python27 # install Python 2.7

To use it, you essentially spawn another shell (or script) while enabling the newer version of Python:

@dirkakrid
dirkakrid / voidstrap.sh
Created December 21, 2016 09:10 — forked from radare/voidstrap.sh
voidstrap.sh
#!/bin/sh
# voidstrap - bootstrap xbps from any *nix
# author: pancake - 2013
if [ -z "$1" ]; then
echo "Usage: voidstrap.sh /path/to/new/root"
exit 1
fi
VOIDROOT="$1"
VOIDPKG=base-chroot