Skip to content

Instantly share code, notes, and snippets.

View garywoodfine's full-sized avatar
🌍
Building things to make stuff better

Gary Woodfine garywoodfine

🌍
Building things to make stuff better
View GitHub Profile
@garywoodfine
garywoodfine / TeamCityAgent.sh
Created July 21, 2018 12:08
TeamCity autostart
#!/bin/sh
### BEGIN INIT INFO
# Provides: TeamCity autostart
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start teamcity daemon at boot time
# Description: Enable service provided by daemon.
# /etc/init.d/teamcity - startup script for teamcity
@garywoodfine
garywoodfine / docker-removify
Created March 2, 2018 14:33
Script to remove old versions of docker
#!/bin/bash
# Uninstall Script
if [ "${USER}" != "root" ]; then
echo "$0 must be run as root!"
exit 2
fi
while true; do
// Code for the blog post https://garywoodfine.com/arrays/
// Decalre the array
var fibonacci = new Array(); // By the end of this our array will contain 1,1,2,3,5,8,13,21,34,55,89
// or
var fibonacci = [];
fibonacci.push(1);
fibonacci.push(1);
fibonacci.push(2);
fibonacci.push(3);
@garywoodfine
garywoodfine / updatify
Created June 12, 2017 21:25
Bash Script to update packages and remove old linux headers
#!/bin/bash
echo "Updating repositories and upgrading any packages"
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
echo "Remove any deprecated packages"
apt-get autoremove -y
echo "change to boot directory"
ls /boot
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
@garywoodfine
garywoodfine / pbcopyfy
Last active May 6, 2023 20:22
Simple Script to configure pbcopy like functionality on ubuntu
#!/bin/sh
# Copyright (C) 2009-2017 Three Nine Consulting
# Always good practice to update packages. However ask user if they would like to do so
# For explanation on how this works and why check out https://garywoodfine.com/use-pbcopy-on-ubuntu/
read -p "Do you want to update your package repositories before proceeding ? " -n 1 -r
echo #adding new line
if [[ $REPLY =~ ^[Yy]$ ]]
then
sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y
fi