Skip to content

Instantly share code, notes, and snippets.

@SupaHam
SupaHam / mongo_registry.go
Created November 6, 2020 23:17
mongo-go-driver UUID decoder & encoder for Golang
// This is a value (de|en)coder for the github.com/google/uuid UUID type. For best experience, register
// mongoRegistry to mongo client instance via options, e.g.
// clientOptions := options.Client().SetRegistry(mongoRegistry)
//
// Only BSON binary subtype 0x04 is supported.
//
// Use as you please
package repository
import (
@dantheman213
dantheman213 / aws-ssm-find-param
Last active August 19, 2019 17:56
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
#!/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
@dantheman213
dantheman213 / docker_cheat_sheet_readme.MD
Last active April 27, 2020 00:43
Docker Cheat Sheet

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 05:05
Download a great Gnu Screen config straight to your current user's environment
#
# 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 March 26, 2024 17:50
FFmpeg cheat sheet
@lgg
lgg / readme.md
Last active March 20, 2024 19:14
Keepass file format explained

Keepass file format explained

I’m currently working (I’m just at the beginning, and I’m quite slow) on a personal project that will use Keepass files (kdb and kdbx).
I tried to find some documentation about .kdb and .kdbx format, but I didn’t find anything, even in the Keepass official website. I you want to know how these file formats are structured, you must read Keepass’s source code. So I wrote this article that explains how Keepass file format are structured, maybe it will help someone.

@tlhunter
tlhunter / average-geolocation.js
Created May 17, 2017 18:00
Calculate the center/average of multiple GeoLocation coordinates
/**
* 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];
}
@yanzhihong23
yanzhihong23 / pm2-guard.js
Created April 28, 2017 10:24
pm2 cpu guard
'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 January 23, 2022 01:40
youtube-dl best way to download video or entire to high quality mp3

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 January 11, 2022 18:15
PostgreSQL & PL/pgSQL Stored Functions Cheatsheet

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$