Skip to content

Instantly share code, notes, and snippets.

Avatar
🚀

Dan dantheman213

🚀
View GitHub Profile
@dantheman213
dantheman213 / aws-ssm-find-param
Last active Aug 19, 2019
Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive result to query, and get a AWS URL to view and edit target
View aws-ssm-find-param
#!/usr/bin/env node
//
// Quickly find AWS SSM params by partial search, use custom AWS profiles, get an interactive
// result to query, and get a AWS URL to view and edit target.
//
// Requires AWS CLI, NodeJS v10+ and Python 2/3
//
// Before running for first time do:
// npm install inquirer
View docker_cheat_sheet_readme.MD

Docker Cheat Sheet

Copy file from container to host

docker cp <containerId>:/file/path/within/container /host/path/target

Stop all running containers

docker stop $(docker ps -aq)
@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
@steven2358
steven2358 / ffmpeg.md
Last active Jan 10, 2021
FFmpeg cheat sheet
View ffmpeg.md
@tlhunter
tlhunter / average-geolocation.js
Created May 17, 2017
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];
}
View pm2-guard.js
'use strict';
const later = require('later');
const logger = require('./logger')('guard');
const pm2 = require('pm2');
const schedule = later.parse.recur().every(10).second();
// set local timezone
later.date.localTime();
@dantheman213
dantheman213 / youtube-dl_cheatsheet.md
Last active Apr 24, 2020
youtube-dl best way to download video or entire to high quality mp3
View youtube-dl_cheatsheet.md

youtube-dl cheat sheet

Docs and Binary for youtube-dl are located here:

https://github.com/rg3/youtube-dl/

Install dependencies

apt-get install libav-tools ffmpeg # Linux (either one of either should do) brew install ffmpeg # OSX choco install ffmpeg # Windows

@dantheman213
dantheman213 / PostgresFunctionsCheatsheetReadme.md
Last active Aug 17, 2017
PostgreSQL & PL/pgSQL Stored Functions Cheatsheet
View PostgresFunctionsCheatsheetReadme.md

PostgreSQL & PL/pgSQL Stored Functions Cheatsheet

Boiler-plate stored function

CREATE OR REPLACE FUNCTION public.sp_user_ins_status(status smallint)
  RETURNS integer
  LANGUAGE plpgsql
AS $function$
@dantheman213
dantheman213 / import_db_structure.sh
Last active Feb 6, 2020
Batch import all *.sql files in a folder recursively into your Postgres or PostgreSQL database
View import_db_structure.sh
#!/bin/sh
# AUTHOR
# DANIEL E. GILLESPIE (2016)
# https://github.com/dantheman213
# DESCRIPTION
# Import all *.sql files in a folder recuresively into your PostgreSQL database
# Batch export all table schemas and stored functions with this script located here:
@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.
You can’t perform that action at this time.