This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# enable IP forwarding | |
sudo sysctl -w net.inet.ip.forwarding=1 | |
# enable PF firewall | |
sudo pfctl -e | |
# Option 1: add NAT rule after en4 is up (USB armory already plugged and started) | |
echo "nat on en0 from en4:network to any -> (en0)" | sudo pfctl -f - | |
# Option 2: add NAT rule before USB armory is plugged, requires specifying its network |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vagrant.configure(2) do |config| | |
config.vm.box = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box" | |
config.vm.hostname = "swift-developer" | |
config.vm.provision "shell", inline: <<-SHELL | |
sudo apt-get install clang-3.6 libicu-dev -y | |
mkdir /opt/swift/ | |
SWIFT_VERSION="2.2-RELEASE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get install clang libicu-dev | |
SWIFT_VERSION="4.0-RELEASE" | |
SWIFT_PLATFORM="ubuntu16.04" | |
wget https://swift.org/builds/swift-$(echo "$SWIFT_VERSION" | tr '[:upper:]' '[:lower:]' )/$(echo "$SWIFT_PLATFORM" | tr -d .)/swift-$SWIFT_VERSION/swift-$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz | |
wget https://swift.org/builds/swift-$(echo "$SWIFT_VERSION" | tr '[:upper:]' '[:lower:]' )/$(echo "$SWIFT_PLATFORM" | tr -d .)/swift-$SWIFT_VERSION/swift-$SWIFT_VERSION-$SWIFT_PLATFORM.tar.gz.sig | |
wget -q -O - https://swift.org/keys/all-keys.asc | gpg --import - |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'wiringpi' | |
# run: rvmsudo ruby blink.rb | |
ledPin = 5 | |
io = WiringPi::GPIO.new | |
io.mode(ledPin, OUTPUT) | |
loop do | |
io.write(ledPin, HIGH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <time.h> | |
#include <wiringPi.h> | |
#include <lcd.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while true ; do | |
if ifconfig wlan0 | grep -q "inet addr:" ; then | |
sleep 60 | |
else | |
echo "WiFi network connection down! Attempting reconnection." | |
ifup --force wlan0 | |
sleep 10 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)" | |
let secs=$((${upSeconds}%60)) | |
let mins=$((${upSeconds}/60%60)) | |
let hours=$((${upSeconds}/3600%24)) | |
let days=$((${upSeconds}/86400)) | |
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"` | |
# get the load averages | |
read one five fifteen rest < /proc/loadavg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'rack/streaming_proxy' | |
use Rack::Auth::Basic, "Restricted Area" do |username, password| | |
[username, password] == ['user', 'password'] | |
end | |
use Rack::StreamingProxy do |request| | |
if request.path.start_with?("/proxy") | |
"http://other.host#{request.path}" |