Skip to content

Instantly share code, notes, and snippets.

View jorgerance's full-sized avatar
💭
I may be slow to respond.

Jorge Rancé Cardet jorgerance

💭
I may be slow to respond.
View GitHub Profile
@jorgerance
jorgerance / index.js
Created January 17, 2020 02:32
[Web scraping with Node.js and PostgreSQL using Puppeteer] #example #node #nodejs #puppeteer #postgresql #postgres #scrpping #crawling
// Puppeteer
const puppeteer = require('puppeteer');
// PostgreSQL
const pg = require('pg');
// Login + PostgreSQL credentials
const CREDS = require('./creds');
// Base URL
const URL = 'https://<WOOCOMMERCE_FQDN>'
const PRODUCT = '<PRODUCT_URL_PATH>'
@jorgerance
jorgerance / figlet_fonts.txt
Last active February 10, 2022 16:22
[Figlet Hamburgefonstiv test] Testing all figlet fonts #fonts #typography #bash #script #Hamburgefonstiv #Hamburgevons
0 ✓ steve@hal9000 ~ $ figlist | \
awk '/fonts/ {f=1;next} /control/ {f=0} f {print}' |\
while read font; do\
printf "\n\n\n>>> Font: $font\n\n"
echo 'Hamburgefonstiv' | \
figlet -w 150 -f $font
done
@jorgerance
jorgerance / jekyll_findAndReplace.sh
Created January 15, 2020 03:22
[findAndReplace.sh] Recursive find files with specific extension within multiple dirs and replace multiple strings. Currently using it on Jekyll builds #jekyll #sed #find #replace #bash #ruby #helper #build
#!/bin/bash
# Source bash output formatting helper
source ${BASH_HELPERS}/msg_format.sh
# Strings to replace before building site "orignal1:::new1" "original2:::new2"
declare -a stringsToReplace=("original1:::new1" "original2:::new2")
for string in "${stringsToReplace[@]}"; do
@jorgerance
jorgerance / fx_msgFormatting.sh
Created January 14, 2020 03:44
[msgFormatting.sh] output formatting bash helper #bash #helper #script #printf #format #emoji #colors
#!/usr/bin/env bash
## Output formatting helper for bash
source ~/.env/bash_helpers/vars_colours.sh
## Get exit status of process that's piped to another
set -o pipefail
## fx
@jorgerance
jorgerance / vars_colours.sh
Created January 14, 2020 03:38
[colors.sh] bash helper for using colors #cli #helper #colors #output
#!/usr/bin/env bash
# Define ANSI color escape code
# color <ansi_color_code>
color() { printf "\033[${1}m"; }
# No Color
NO_COLOR=$(color "0")
NC=${NO_COLOR}
@jorgerance
jorgerance / killit.sh
Created January 14, 2020 03:29
[killit.sh] Easily killing all processes related to a specific binary #bash #macos #cli #tool #script
#!/bin/bash
source $HOME/.env/old_dot_custom/fx_msgFormatting.sh
_scriptname="$(basename $0)"
_forceKill=$1
_stringtokill="$@"
function pidlist_gen() {
ps -eo pid= -o cputime= -o comm= | grep -v grep | grep -i ${_stringtokill}
@jorgerance
jorgerance / macos_system_defaults.md
Last active March 5, 2024 10:37
[macOS system defaults]

Drag Dashboard Widgets onto the Desktop

defaults write com.apple.dashboard devmode YES

Disable Auto-window-restore annoying feature

This is actually a pain in the as since has to be done for each application.

@jorgerance
jorgerance / brew_install_gnu_utils.md
Last active January 1, 2020 00:40
[Install GNU utils on macOS]

As of 2019 --with-default-name is deprecaded. Updated packages to install below:

GNU Core Utilities:

brew install coreutils

Common utilities:

brew install binutils
@jorgerance
jorgerance / accessing_sqlite3_encrypted_db.md
Created December 30, 2019 12:14
[Accesing SQLite encrypted DB] - Using sqlcipher and sqlite3
0 ✓ steve@hal9000 ~ $ sqlcipher jeanscollection.db
# insert password for decryption
PRAGMA key = '<PASSWORD>';
> ok
# show databases
.databases
> main: /Users/steve/jeanscollection.db
# show tables
.tables
@jorgerance
jorgerance / tor-install-service-isolate-macos.md
Created December 24, 2019 07:20
[tor isolation - macOS] tor as a service on multiple ports #homebrew #tor #privacy

Install tor on macOS

0 ✓ user@macos ~ $ brew install tor
==> Downloading https://homebrew.bintray.com/bottles/tor-0.4.2.5.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/82/8231f0d4bf6e158a85672f9a29a8bccb50152cf039cbc996b29f45031dc65e29?__gda__=exp=1577172051~hmac=89164770fc6a2d95795cf220c52b76e9f809a781307557930ddce7f6c1a6
######################################################################## 100.0%
==> Pouring tor-0.4.2.5.mojave.bottle.tar.gz
==> Caveats
To restart tor after an upgrade: