Skip to content

Instantly share code, notes, and snippets.

View alecthegeek's full-sized avatar
🤖
Dem keyboards don't go click click on their own you know

Alec Clews alecthegeek

🤖
Dem keyboards don't go click click on their own you know
View GitHub Profile
@alecthegeek
alecthegeek / mult.rb
Last active September 17, 2017 00:27
#!/usr/bin/env ruby
=begin Display the multiplication tables
My first computer program, written in Sept 1978, did the same
thing. I did not know about iteration using for or while and
so it was implemented using if and goto :-(. This was on an
ICL mainframe using MAXIMOP BASIC.
As you can see computer science, and I, have moved on since.
@alecthegeek
alecthegeek / start_vpn.expect
Created January 5, 2017 03:31
Start the CISCO VPN client from the command line
#!/usr/bin/env expect -f
# Start the CISCO VPN client on a Mac. Adapted from
# https://blog.felipe-alfaro.com/2014/05/23/automating-cisco-anyconnect-secure-mobility-client-on-mac-os-x/
set HOSTNAME vpn.server.com
set USER_NAME user.name
set PASSWORD password
spawn /opt/cisco/anyconnect/bin/vpn
@alecthegeek
alecthegeek / ConfigPocketPC
Last active March 9, 2017 22:41
Setup packages and improve security on PocketCHIP
#!/bin/bash
# Set up my PocketCHIP (Debian Linux)
# NB It's recommended you set up ssh key auth before running this script
# Extra tools -- edit this to suite what you want on your CHIP
OPTIONAL_PACKAGES="vim-gtk git build-essential python-serial arduino arduino-mk"
# Update
# 1st lets fix an occasional but obscure problem during upgrade
@alecthegeek
alecthegeek / Package List
Created August 17, 2016 02:05
A list of all the Hombrew and Cask packages I have installed today
A list of brew packages
ack
ansible
ant
aspell
autoconf
automake
bfg
byacc
c-ares
@alecthegeek
alecthegeek / fsck4pi.sh
Created August 6, 2016 09:17
Make a Rasbperry Pi always perform a file system check and repair on boot
# Make the pi run file system check/repair on every boot (need to clear out old settings 1st)
sudo sed -i -e 's/ fsck\.\(repair\|mode\)=[^ ]*//;
s/$/ fsck.mode=force fsck.repair=yes/' /boot/cmdline.txt
@alecthegeek
alecthegeek / gitcomenu.sh
Last active July 14, 2017 13:05
Make `git checkout <branch>` into a menu selection
OPS3=$PS3
echo There are multiple branchs in this repo. Please select the one you want to use
PS3='If you're not sure just choose "master" '
select br in $(git branch|sed -e '/^[* ] /s///'); do
[[ -n $br ]] && git checkout $br &&
break
done
PS3=$OPS3
@alecthegeek
alecthegeek / sooooon.py
Created December 20, 2015 08:59
Dad Joke
#!/usr/bin/env python3
print("S",end='')
for i in range(int(10E3)):
print('o',end='')
print('n',end=None)
@alecthegeek
alecthegeek / LICENSE
Last active November 14, 2015 02:16 — forked from ajfisher/LICENSE
Preparation for BuzzConf
The MIT License (MIT)
Copyright (c) 2015 ajfisher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@alecthegeek
alecthegeek / ssh2vb
Last active November 14, 2015 23:18
ssh into a local Virtual Box Guest OS
#!/usr/bin/env bash
# ssh into a running Virtual Box guest machine
if [[ $# == 0 || $1 == -h || $1 == -? || $1 == --help ]] ; then
echo
echo usage: $(basename $0) '[<username>@]<machinename>'
echo
echo 'ssh into Virtual Box <machinename>, optionlly using <username>'
exit 1
@alecthegeek
alecthegeek / bashrc.sh
Last active August 29, 2015 14:27
Using Homebrew and prefer GNU utils over OS X BSD programs? Add this to ~/.bashrc
# Use the GNU utils instead of the BSD versions from OS X
# Updates the path if anythings with a gnubin dir changes after
# upgrade
if [[ -n "$(brew --prefix )" ]] ; then
if [[ -e ~/.GNUBINS ]] ; then
GNUBINS=$(cat ~/.GNUBINS)
else
echo "Not Found GNUBINS"
GNUBINS="___NotFoundGNUBINS___"
fi