Skip to content

Instantly share code, notes, and snippets.

View scarytom's full-sized avatar
💻
coding

Tom Denley scarytom

💻
coding
View GitHub Profile
@scarytom
scarytom / gh-bak
Last active December 16, 2015 17:29
github backup script development
#!/bin/bash
set -e
set -u
API_URL="https://api.github.com"
TMP_DIR="/tmp/gh-bak"
curl -s "$API_URL/orgs/netmelody/repos" | grep '"full_name":' | sed -rn 's/.*: \"(.*?)\".*/\1/p' > $TMP_DIR/repos.lst
curl -s "$API_URL/users/scarytom/repos" | grep '"full_name":' | sed -rn 's/.*: \"(.*?)\".*/\1/p' >> $TMP_DIR/repos.lst
@scarytom
scarytom / gmail-bak
Created April 27, 2013 21:58
gmail backup script development
http://www.enigmacurry.com/2008/02/22/backing-up-my-online-brain/
http://docs.offlineimap.org/en/latest/offlineimap.html
http://comments.gmane.org/gmane.mail.imap.offlineimap.general/5515
@scarytom
scarytom / register_node.sh
Created June 25, 2013 14:58
bash script to register new jenkins node
#!/bin/bash
# jenkins master vitals
CI_MASTER_HOST="ci-1.youdevise.com"
CI_MASTER_PORT="80"
# node vitals
NODE_HOST="tom-denley-rocks-01.youdevise.com"
NODE_NAME="tom-denley-rocks-name-01"
NODE_DESC="my node of glory"
@scarytom
scarytom / remove-nodes-safely.sh
Last active May 9, 2023 20:16
Script to safely de-register jenkins nodes usage: $ remove-nodes-safely.sh my-node-1 my-node-2 my-node-3
#!/bin/bash
set -e
set -u
CI_MASTER_URL="http://ci-1"
node_online() {
curl --silent "$CI_MASTER_URL/computer/$1/api/json" | grep --silent '"temporarilyOffline":false'
}
@scarytom
scarytom / mirror-github.sh
Last active March 26, 2018 13:49
Script to mirror github repos, designed to be run as a cron -- usage: $ mirror-github.sh bob/pet_proj dave/ fred/cool_proj
#!/bin/bash -eu
# Mirrors GitHub repos
# Takes a list of repos to mirror formatted as "user/reponame".
# The reponame can be omitted to mirror all repos for a user or organisation e.g. "youdevise/"
# The repos for a team can be mirrored using the syntax "team:orgname/teamname
#FIXME these might be better as arguments
MIRROR_DIR="${MIRROR_DIR:-/tmp/githubhmirror}"
GITHUB_USER="${GITHUB_USER:-}"
@scarytom
scarytom / 1_temper_instructions.md
Last active December 21, 2015 17:28
configuring temper sensor for non-root access

detect the device

  • start with the device unplugged
  • run udevadm monitor --udev
  • plug in the device
  • see output in udevadm_monitor.out
  • the device is recognisable on the third to last line as: /dev/usb/hiddev0

find device details

@scarytom
scarytom / instructions.md
Created September 1, 2013 11:35
wireless configuration on raspberry pi

Generating the PSK value for wpa_supplicant.conf

$ wpa_passphrase SSID

@scarytom
scarytom / kvm_mem.sh
Created September 19, 2013 14:28
work out the memory usage of a kvm host
#!/bin/bash
virsh list | tail -n +3 | head -n -1 | awk -F" " '{print $2}' | sed 's/.*/\/etc\/libvirt\/qemu\/\0.xml/' | xargs grep memory
grep MemTotal /proc/meminfo
@scarytom
scarytom / aptly-upload.sh
Last active August 29, 2015 14:01
Aptly Package Upload
#!/bin/bash -eu
LOCKFILE='/var/lock/.aptly-upload.exclusivelock'
LOCK_TIMEOUT_SECONDS='300'
PROMOTE=0
DISTRIBUTION='all'
STABLE_PREFIX='stable'
UNSTABLE_PREFIX='unstable'
@scarytom
scarytom / keebase.md
Created August 16, 2014 09:19
keebase.md

Keybase proof

I hereby claim:

  • I am scarytom on github.
  • I am scarytom (https://keybase.io/scarytom) on keybase.
  • I have a public key whose fingerprint is C819 4255 49F4 4CD5 8DCC 8BB7 E409 354C FB27 2F39

To claim this, I am signing this object: