This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// patch console.log to show filename and line number for every logged message | |
// | |
// ./src/index.js:68:9 √ Connected to Sentry | |
// ./src/index.js:72:9 √ Connected to Stripe | |
// ./src/index.js:82:9 √ Connected to Backblaze | |
// ./src/index.js:99:9 √ Connected to FireBase | |
// ./src/routes/paypal.js:68:17 Error: Request failed with status code 401 | |
// at createError (./node_modules/axios/lib/core/createError.js:16:15) | |
// at settle (./node_modules/axios/lib/core/settle.js:17:12) | |
// at IncomingMessage.handleStreamEnd (./node_modules/axios/lib/adapters/http.js:236:11) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Usage: | |
# pip3 install PyGithub | |
# | |
# echo someusername | python3 check_github_usernames.py | |
# # or | |
# python3 check_github_usernames.py < list_of_usernames.txt | |
# | |
# [+] Starting to check 1212 usernames on GitHub... | |
# X agq (is taken) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Get all the information you could ever want about the STDIN, STDOUT, STDERR file descriptors (e.g. is it a TTY, terminal, pipe, redirection, etc.) | |
# Works cross-platform on Windows, macOS, Linux, in Docker, and in Docker-Compose by using stat library | |
# | |
# Useful for detecting and handling different stdin/stdout redirect scenarios in CLI scripts, | |
# e.g. is the user piping a file in or are they interactively typing things in? | |
# is the process output being saved to a file or being printed to a terminal? | |
# can we ask the user for input or is it a non-interactive masquerading as a TTY? | |
# | |
# Further reading: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[program:example-server] | |
command=npm run start:dev | |
directory=/opt/%(program_name)s | |
stdout_logfile=/opt/%(program_name)s/data/logs/server.log | |
redirect_stderr=true | |
autostart=true | |
autorestart=true | |
startretries=5 | |
stopwaitsecs=30 | |
stopsignal=TERM |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Requires: ffmpeg, exiftool (install via apt/brew first) | |
# Usage: | |
# $ cd ~/Videos | |
# $ ./compress_videos.sh | |
# [+] Converting all .mp4 files in ~/Videos to .x265.mp4 files... | |
# - √ GP013838.mp4 (2.5GB) -> GP013838.x265.mp4 (142MB) | |
# - √ ... | |
# [√] Done converting all .mp4 files in $PWD. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# Requires: exiftool, mediainfo (install via apt/brew first) | |
# Usage: | |
# $ cd ~/Videos | |
# $ ./rename_videos.sh | |
# GP013838.MP4 -> 2018-10-12_08-59-59__Montreal_QC_Canada__GP013838.mp4 | |
# ... | |
GOOGLE_MAPS_API_KEY="yourkeyhere" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env fish | |
# Script to store and retrieve config/secret key=value pairs in Cloudflare DNS records | |
# Encrypts secrets with a specified passphrase + salt using AES-256-CBC | |
# | |
# Usage: | |
# | |
# $ set_config some_config_key "example config value abc" | |
# $ get_config some_config_key | |
# example config value abc | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example database container setups for PostgreSQL, MariaDB, Redis, Memcached, MongoDB, Neo4j, Hasura GraphQL, CockroachDB, and TiDB in Docker Compose | |
# https://gist.github.com/pirate/1fafaa18a47254f388aa5c0f79f7d263 | |
# Goes well with these docker-compose networking/ingress container examples: | |
# https://gist.github.com/pirate/1996d3ed6c5872b1b7afded250772f7c | |
version: '2.4' | |
services: | |
postgres: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_tenant_schemas(): | |
if IS_TESTING or IS_MIGRATING: | |
return ["public", "test"] | |
DATABASE_UTIL_CONNECTION = psycopg2.connect( | |
host=POSTGRES_HOST, | |
port=POSTGRES_PORT, | |
sslmode=POSTGRES_SSL, | |
user=POSTGRES_USER, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2.4' | |
services: | |
mariadb: | |
image: mariadb:10 | |
volumes: | |
- ./data/mariadb:/var/lib/mysql | |
environment: | |
MYSQL_DATABASE: wordpress | |
MYSQL_USER: wordpress |