Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Dan dantheman213

🚀
View GitHub Profile
@dantheman213
dantheman213 / docker_clean.sh
Last active Jan 18, 2021
Reset Docker to a clean vanilla state
View docker_clean.sh
#!/usr/bin/env bash
# Reset Docker to a clean vanilla state. Will destroy all containers, images, networks, volumes, and cache.
[ $(docker ps | wc -l) -ne 1 ] && echo "Stopping all containers..." && docker stop $(docker ps | sed -n '1d;p' | awk -F" " '{print $1}')
[ $(docker ps -a | wc -l) -ne 1 ] && echo "Deleting all containers..." && docker rm $(docker ps -a | sed -n '1d;p' | awk -F" " '{print $1}')
[ $(docker images | wc -l) -ne 1 ] && echo "Deleting all images..." && docker image rm $(docker images | sed -n '1d;p' | awk -F" " '{print $3}')
echo "Pruning networks, volumes, and cache..." && docker system prune -a -f --volumes
echo "Docker is back to Vanilla... COMPLETE!"
View uninstall_docker.md

To completely uninstall Docker:

Step 1

dpkg -l | grep -i docker To identify what installed package you have:

Step 2

sudo apt-get purge -y docker-engine docker docker.io docker-ce

@dantheman213
dantheman213 / count_lines_of_code_git.sh
Created May 27, 2017
Count how many lines of code are in git repo
View count_lines_of_code_git.sh
git ls-files | xargs wc -l
@dantheman213
dantheman213 / install-deepin-arch-manjaro-readme.md
Last active Sep 14, 2020
Install Deepin Desktop Environment from a minimum Arch or Manjaro Install Operating System
View install-deepin-arch-manjaro-readme.md

Install Deepin Desktop Environment In Arch or Manjaro

I recommend doing this as a net/minimum install with Manjaro (no desktop manager attached with the install).

Update sources & packages

pacman -Syu
reboot -h now
@dantheman213
dantheman213 / average-geolocation.js
Created Aug 23, 2020 — forked from tlhunter/average-geolocation.js
Calculate the center/average of multiple GeoLocation coordinates
View average-geolocation.js
/**
* Calculate the center/average of multiple GeoLocation coordinates
* Expects an array of objects with .latitude and .longitude properties
*
* @url http://stackoverflow.com/a/14231286/538646
*/
function averageGeolocation(coords) {
if (coords.length === 1) {
return coords[0];
}
@dantheman213
dantheman213 / exponential_backoff.go
Last active Aug 11, 2020
Golang exponential back off simple example
View exponential_backoff.go
package main
import "fmt"
import "time"
import "math"
var exponentialBackoffCeilingSecs int64 = 14400 // 4 hours
func main() {
fmt.Println("Hello World")
View update_nodejs_npm_linux.sh
Update nodejs to latest version:
sudo npm install -g n
sudo n latest
Update npm to latest version:
sudo npm install -g npm
Do what @runcible suggested
hash -d npm
@dantheman213
dantheman213 / export_db_structure.sh
Last active Jun 10, 2020
Batch backup and export your Postgres or PostgreSQL table schemas and stored functions or procedures into individual *.sql files --the easy way!
View export_db_structure.sh
#!/bin/sh
# AUTHOR
# DANIEL E. GILLESPIE (2016)
# https://github.com/dantheman213
# DESCRIPTION
# Export your app's table schemas and stored functions from a PostgreSQL
# database into individual *.sql files for easy management and source control.
View sudo-no-password.sh
echo "username ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
@dantheman213
dantheman213 / install_great_gnu_screen_config.sh
Last active May 10, 2020
Download a great Gnu Screen config straight to your current user's environment
View install_great_gnu_screen_config.sh
#
# Download a great Gnu Screen config straight to your current user's environment
#
# Just paste that in wherever env you're at and run `screen` and you'll have a good configuration with a status bar,
# tabs, no warning screen, beeps/bells/alerts, and more.
#
# Screen Config (.screenrc) located here:
# Gist: https://gist.github.com/dantheman213/8df6fabb1bc6fc192c9e
# Raw: https://gist.githubusercontent.com/dantheman213/8df6fabb1bc6fc192c9e/raw/bfd65a3695974b94223849c516b5b58828932613/Great%2520GNU%2520Screen%2520config