Skip to content

Instantly share code, notes, and snippets.

View jameswhite's full-sized avatar
📁
copying files

James S White jameswhite

📁
copying files
View GitHub Profile
@jameswhite
jameswhite / SslUtil.java
Created January 16, 2017 03:01 — forked from sharonbn/SslUtil.java
SSL/TLS connection from Eclipse Paho Java client to mosquitto MQTT broker
import java.io.*;
import java.nio.file.*;
import java.security.*;
import java.security.cert.*;
import javax.net.ssl.*;
import org.bouncycastle.jce.provider.*;
import org.bouncycastle.openssl.*;
public class SslUtil
@jameswhite
jameswhite / raspi-watchdog.txt
Created December 30, 2016 00:29
enable the hardware watchdog in raspbian
grep -q "bcm2835_wdt" /etc/modules || echo "bcm2835_wdt" | sudo tee -a /etc/modules
dpkg -l | grep -q "ii *watchdog" || sudo apt-get install -y watchdog
[ ! -f /etc/watchdog.conf.dist ] && sudo cp /etc/watchdog.conf /etc/watchdog.conf.dist
cat<<EOF | sudo tee /etc/watchdog.conf
max-load-1 = 24
watchdog-device = /dev/watchdog
realtime = yes
priority = 1
EOF
sudo update-rc.d watchdog defaults
" Transparent editing of gpg encrypted files.
" By Wouter Hanegraaff
augroup encrypted
au!
" First make sure nothing is written to ~/.viminfo while editing
" an encrypted file.
autocmd BufReadPre,FileReadPre *.gpg set viminfo=
" We don't want a various options which write unencrypted data to disk
autocmd BufReadPre,FileReadPre *.gpg set noswapfile noundofile nobackup
# export PASSWORD="bobloblawslawblog
# export USER=jameswhite
(
cd /var/cache/git/easy-rsa/easyrsa3;
./easyrsa gen-req ${USER}.user.thebikeshed.io nopass
./easyrsa sign-req client ${USER}.user.thebikeshed.io
# openssl rsa -in pki/private/${USER}.user.thebikeshed.io.key -out pki/private/${USER}.user.thebikeshed.io.ckey
openssl pkcs12 -export \
-out ${USER}.user.thebikeshed.io.p12 \
-inkey pki/private/${USER}.user.thebikeshed.io.key \
#!/usr/bin/perl -w
eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}'
if 0; # not running under some shell
use strict;
use Net::MQTT::Simple;
use Getopt::Long qw(GetOptions);
$| = 1;
#!/usr/bin/env bash
# Bomb out if we hit an error, ever
set -e
# Verbose output in debug mode
[ -n "" ] && {
set -x
}
#!/usr/bin/env perl
use JSON;
use Net::MQTT::Simple::SSL;
my $json = JSON->new->allow_nonref;
my $mqtt = Net::MQTT::Simple::SSL->new( "mqtt:8883",
{
SSL_ca_file => '/etc/ssl/certs/ca.crt',
SSL_cert_file => '/etc/ssl/certs/localhost.crt',
SSL_key_file => '/etc/ssl/private/localhost.ckey',
alias off='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"black\"}"'
alias blue='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"blue\"}"'
alias orange='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"orange\"}"'
alias yellow='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"yellow\"}"'
alias red='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"red\"}"'
alias on='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"white\"}"'
alias loop='mqtts bikeshed/hue@mqtt "{\"action\":\"effect\",\"effect\":\"colorloop\",\"lights\":\"all\"}"'
alias stop='mqtts bikeshed/hue@mqtt "{\"action\":\"effect\",\"effect\":\"none\",\"lights\":\"all\"}"'
alias redalert='mqtts bikeshed/hue@mqtt "{\"action\":\"color\",\"lights\":\"all\",\"color\":\"red\",\"alert\":\"lselect\"}"'
Southwest has server troubles
Finally get through and check in and get boarding pass
Southwest flight cancelled
Stand in long line with person behind me having a loud conversation about a girl his friend wants to sleep with right in the back of my head the whole time
Southwest can't get me out until the next day
All other airlines booked except AA with a 1 hr layover in Miami
First leg of AA flight delayed 1h 15m
Stand in line to get re-booked, they can't determine why my first leg was delayed which decides if I get a hotel voucher, so they send me to another line
I find myself more annoyed at the other people in line than being in the line, especially how they treat the airport staff.
Stand in even longer line, get 9AM flight a hotel voucher, 2 shuttle vouchers, $12 dinner voucher, $7 breakfast voucher
### kano_screen_used: LG_ULTRAWIDE
# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1
# Force sound to go through the analog output even if an HDMI monitor is plugged in
# Not strictly necessary for most apps that default to local device (sonic-pi).
#hdmi_ignore_edid_audio=0
# 1 -> perfect size
# 0 -> added black border for TVs