Skip to content

Instantly share code, notes, and snippets.

View kokoye2007's full-sized avatar

kokoye2007 kokoye2007

View GitHub Profile
@kokoye2007
kokoye2007 / ubuntu-after-install.sh
Created June 3, 2018 19:48
Ubuntu After Install Script
#!/bin/bash
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
else
#Update and Upgrade
echo "Updating and Upgrading"
apt-get update && sudo apt-get upgrade -y
@kokoye2007
kokoye2007 / sed cheatsheet
Created June 13, 2018 19:00 — forked from un33k/sed cheatsheet
magic of sed -- find and replace "text" in a string or a file
FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
@kokoye2007
kokoye2007 / mysql_secure.sh
Created January 19, 2019 14:04 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation
#!/bin/bash
aptitude -y install expect
// Not required in actual script
MYSQL_ROOT_PASSWORD=abcd1234
SECURE_MYSQL=$(expect -c "
set timeout 10
@kokoye2007
kokoye2007 / create-docker-droplet.sh
Created February 3, 2019 10:30 — forked from christianberg/create-docker-droplet.sh
Shell script to create a Digital Ocean Droplet and install docker
#!/bin/bash
set -e
SECRETFILE=~/.digitalocean
if [[ -z $DIGOCEAN_ID ]] || [[ -z $DIGOCEAN_KEY ]]; then
if [ -e $SECRETFILE ]; then
. $SECRETFILE
fi
fi
[server]
SERVER
[server:vars]
server_name=SERVER
docker_nginx_ssl=true
@kokoye2007
kokoye2007 / git-tag-remove-rename
Created March 8, 2019 18:05 — forked from danielestevez/gist:2044589
GIT Commit to an existing Tag
1) Create a branch with the tag
git branch {tagname}-branch {tagname}
git checkout {tagname}-branch
2) Include the fix manually if it's just a change ....
git add .
git ci -m "Fix included"
or cherry-pick the commit, whatever is easier
git cherry-pick {num_commit}
@kokoye2007
kokoye2007 / grub-reinstall
Last active March 10, 2019 10:00
How to reinstall grub2 efi bootloader on ubuntu
#hd-efi=/dev/sda1
#hd-root=/dev/sda2
#hd-hdd=/dev/sda
[ -d /sys/firmware/efi ] && echo "EFI boot on HDD" || echo "Legacy boot on HDD"
sudo mount $hd-root /mnt
#if UEFi
sudo mount $hd-efi /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
@kokoye2007
kokoye2007 / git-clearHistory
Last active March 26, 2019 18:37 — forked from stephenhardy/git-clearHistory
Steps to clear out the history of a git/github repository
-- Remove the history from
rm -rf .git
-- recreate the repos from the current content only
git init
git add .
git commit -m "Initial commit"
-- push to the github remote repos ensuring you overwrite history
git remote add origin [email protected]:<YOUR ACCOUNT>/<YOUR REPOS>.git
@kokoye2007
kokoye2007 / build.sh
Created April 18, 2019 17:07 — forked from Forst/build.sh
Ubuntu ISO with preseed.cfg generation script
#!/bin/bash
## FORSTWOOF UBUNTU PRESEED :: BUILD SCRIPT
# Quit on first error
set -e
# Temporary directory for the build
TMP="/var/tmp/ubuntu-build"
@kokoye2007
kokoye2007 / old-snap-remove.sh
Created August 4, 2019 10:35
Sanp Old Version Remove
#!/bin/bash
# Removes old revisions of snaps
# CLOSE ALL SNAPS BEFORE RUNNING THIS
set -eu
LANG=C snap list --all | awk '/disabled/{print $1, $3}' |
while read snapname revision; do
snap remove "$snapname" --revision="$revision"
done