Skip to content

Instantly share code, notes, and snippets.

@arobb
arobb / gist:726b604114856d60e03a
Last active September 27, 2015 17:36
Enable Raspberry Pi HRNG and generate OpenSSL Elliptic Keys
# From
# https://sites.google.com/site/astudyofentropy/project-definition/raspberry-pi-internal-hardware-random-number-generator
# http://scruss.com/blog/2013/06/07/well-that-was-unexpected-the-raspberry-pis-hardware-random-number-generator/
# Install the kernel module for the hardware RNG
# After this command, random data is available from /dev/hwrng
sudo modprobe bcm2708-rng
# Make sure it's activated each boot
# Add this to /etc/modules
@arobb
arobb / gist:9d1c4a21bf67a01ff5e3
Last active March 20, 2016 01:38
Access ZFS array on Mac without Open ZFS on OS X (O3X)
#
# Access ZFS array on Mac without Open ZFS on OS X (O3X)
#
# Origin: O3X crashing computer, and drive array could not be attached
# as a complete set (as a USB device) to a VM. Used only as recovery
# mechanism to extract data from the ZFS array. ZFS is not fully
# supported on Ubuntu 15 (should be baked into 16).
#
# Requires raw access to the disks: directly attach as USB device
# or (as in this description) disks are accessed as raw devices
# Machine with internet access
virtualenv -p $(which python2.7) venv
source venv/bin/activate
mkdir pip-sources
pip download --no-binary ./pip-sources <package1>
pip download --no-binary ./pip-sources <package2>
pip install --no-index --find-links=./pip-sources <package1> <package2>
pip freeze > pip_requirements.txt
tar czf required-packages.tar.gz pip_requirements.txt ./pip-sources
# ip utility (OS X)
git clone git@github.com:brona/iproute2mac.git
sudo cp iproute2mac/src/ip.py /usr/local/bin/ip
sudo chown root:wheel /usr/local/bin/ip
# LZO headers (OS X)
http://www.oberhumer.com/opensource/lzo/#download
~/Download/lzo-2.09/src
./configure
make
Encrypt: gpg --armor --output <out enc file> --symmetric --cipher-algo AES256 <in clear file>
Decrypt: gpg --output <out clear file> --decrypt <in clear file>
#!/bin/bash
# Decrypt GPG files in current directory
# Files created with gpg --armor --output <out enc file> --symmetric --cipher-algo AES256 <in clear file>
read -s -p "Enter Password: " pw
echo -ne "\033[0K\r"
for infile in *.gpg;
do
outfile=${infile%.gpg}
apt-get install bc
git clone https://github.com/openssl/openssl.git
git checkout OpenSSL_1_0_2-stable
./config enable-egd zlib threads no-ssl2 no-ssl3 no-weak-ssl-ciphers
make depend
make
make test
@arobb
arobb / openvpn-server.ovpn
Last active September 4, 2016 04:39
OpenVPN Server Config
# OpenVPN Configuration
# Multiple files will start independent daemons
# Basic options
## Logging
log-append /var/log/openvpn.log
verb 3
## Listen port
dev tun
@arobb
arobb / rpi-config.txt
Last active October 13, 2021 16:01
Raspberry Pi initial configuration
# IP and new hostname of PI
PI_IP=""
PI_NEW_HOSTNAME=""
# Set ssh keys, use default password
cat ~/.ssh/id_rsa.pub | ssh pi@"$PI_IP" 'cat >> .ssh/authorized_keys'
# Connect to the pi
ssh pi@"$PI_IP"
@arobb
arobb / rpi-temp.sh
Created October 2, 2016 00:55
Temperature from Raspberry Pi
#!/usr/bin/env bash
vcgencmd measure_temp | sed -n 's/temp=\([0-9.]*\).*$/\1/p' | bc <<< "9 / 5 * `cat` + 32"