Skip to content

Instantly share code, notes, and snippets.

@FredLackeyOfficial
FredLackeyOfficial / setup-docker.sh
Last active Apr 11, 2020
Setup Docker on Linux
View setup-docker.sh
#!/bin/bash
# curl https://gist.githubusercontent.com/FredLackeyOfficial/d993aa52fbd2795bf39e9226db572dba/raw/setup-docker.sh | sudo bash
# bash <(curl -Ls https://gist.githubusercontent.com/FredLackeyOfficial/d993aa52fbd2795bf39e9226db572dba/raw/setup-docker.sh)
sudo apt remove docker docker-engine docker.io
sudo apt install apt-transport-https ca-certificates curl software-properties-common gnupg
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@FredLackeyOfficial
FredLackeyOfficial / eod.sh
Last active Feb 7, 2020
Push EOD changes to Git
View eod.sh
#!/bin/bash
CUR_DIR=$(pwd)
echo "Committing end of day changes ..."
for i in $(find . -name ".git" | cut -c 3-); do
echo "";
echo "Committing $i ...";
@FredLackeyOfficial
FredLackeyOfficial / README.md
Last active Oct 27, 2017
Add Cron Job to Restart CGMiner Service Periodically
View README.md

1. SSH Into Controller
Self explainatory.

2. Create Shell Script
Create the folder, the file...

mkdir /usr/share/cron/  
vi /usr/share/cron/cgrestart.sh  

The script is...

@FredLackeyOfficial
FredLackeyOfficial / README.md
Last active Oct 25, 2017
Using DbSchema with Postgres, Sequelize, and Sequelize-Auto
View README.md

Using DbSchema with Postgres & Sequelize

The road to using Postgres, Sequelize, Sequelize-Auto, and DbSchema have some bumps along the way. More specifically, these "bumps" have to do with automatic incrementing and audit fields. These are the steps I recommend when working with this combination.

Rule #1: Do not use Sync
Sequelize-Auto does not handle indexes. For this reason, any indexes created in DbSchema will be ignored. This is why we use DbSchema to work with database modifications. We only tweak enough of Sequelize's models to work with the columns. Since the models will not have indexes by default, we must never use Sequelize to push changes to the database.

The process...

1. Define Sequences

@FredLackeyOfficial
FredLackeyOfficial / git-keep
Created Jun 21, 2017 — forked from miraculixx/git-keep
create .keep files for empty directories currently ignored by git
View git-keep
#!/bin/bash
# create .keep files for empty directories currently ignored by git
# run git clean -nd to see which directories are empty and therefore ignored by git currently
# run git keep to add these directories by adding a .keep file
# see this discussion http://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory-to-a-git-repository/21422128#21422128
git clean -nd | awk '{ print $3 }' | xargs -L1 -I{} touch {}.keep
@FredLackeyOfficial
FredLackeyOfficial / dreamfactory-docker-up.sh
Created Jun 21, 2017
Bash script to bring up Dreamfactory in Docker
View dreamfactory-docker-up.sh
#!/bin/bash
main(){
local PROJECT_PATH="$(realpath "../")";
local PROJECT_NAME="$(basename $PROJECT_PATH)";
create_network "$PROJECT_NAME"
create_databases "$PROJECT_NAME"
create_dreamfactory "$PROJECT_NAME"
}
@FredLackeyOfficial
FredLackeyOfficial / remove-all-group-members.js
Created Mar 30, 2017
Remove all members from Facebook group
View remove-all-group-members.js
// Load the group's member list and then paste this into the console.
// You may have to hit RETURN after the end of it.
// And you'll also have to click the CONFIRM button a bunch of times.
var deleteAllGroupMembers = (function () {
var deleteAllGroupMembers = {};
// the facebook ids of the users that will not be removed.
// IMPORTANT: add your own facebook id here so that the script will not remove yourself!
var excludedFbIds = ['1234','11223344']; // make sure each id is a string!
var usersToDeleteQueue = [];
@FredLackeyOfficial
FredLackeyOfficial / ncu-update-all.sh
Created Mar 14, 2017
Use npm-check-updates recursively to update Node modules and Bower components.
View ncu-update-all.sh
cmd_exists() {
command -v "$1" &> /dev/null
}
ncu-update-all(){
if ! cmd_exists "ncu"; then
printf "ncu is required, please install it!\n"
exit 1
fi
@FredLackeyOfficial
FredLackeyOfficial / ips.sh
Last active Mar 1, 2017
Simple bash function to find all active IP address, their MAC address, and the adapter manufacturer.
View ips.sh
cmd_exists() {
command -v "$1" &> /dev/null
}
ips(){
local usage="ips [%NETWORK_BASE_IP%] [%BIT_DEPTH%] [ip-only | no-sudo]"$'\n'"Default IP: 192.168.1.0"$'\n'"Default Mask: 24"
local addr="$1";
local mask="$2";
local prefix="";
local suffix="";
@FredLackeyOfficial
FredLackeyOfficial / get-tunes.sh
Created Mar 1, 2017
Simple bash function to pull down videos and audio tracks from YouTube playlists.
View get-tunes.sh
get-tunes(){
local usage="get-tunes %PLAYLIST_OR_VIDEO_URL% [audio-only | video-only]";
local url="$1";
local option="$2";
local prefix="";
if [ -f "/usr/local/bin/youtube-dl" ]; then
prefix="/usr/local/bin/";
fi
if [ -z "${url}" ]; then
echo "Problem fetching track: Track URL not supplied";
You can’t perform that action at this time.