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 / goinstallbinaries.sh
Created June 13, 2015 06:02
Using Vim and Vundle when developing Go code?
GOPATH=/tmp/$$.installgobin GOBIN=$(go env GOROOT)/bin vim -u ~/.vimrc -c ":GoInstallBinaries" -c ":q" /tmp/src/$$.go
@alecthegeek
alecthegeek / deletesillycupsfiles
Created July 4, 2015 05:19
Remove spurious CUPS files created in /tmp
#!/usr/bin/env sh
# Remove spurious CUPS files created in /tmp
find /private/tmp -maxdepth 1 -type l -name 55\*|sudo xargs rm
@alecthegeek
alecthegeek / manageCloudStorageSync.sh
Created July 27, 2015 13:07
Pauses and Resumes data sync with cloud storage services
#!/usr/bin/env bash
# Pause the following Cloud Storage Services
services=('Google Drive' Copy Dropbox)
# Based on ideas and code on https://github.com/tjluoma/dropbox-pause-unpause
if [[ $0 =~ pause || $1 =~ pause ]] ; then
command=STOP
@alecthegeek
alecthegeek / g
Created August 11, 2015 22:51
Google search from command line on a Mac
#!/usr/bin/env sh
# Google search from command line on a Mac
open "http://www.google.com/search?q=$(echo "$@" | sed -Ee 's/\s+/%20/g')"
@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
@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 / 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 / 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 / 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 / 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