Skip to content

Instantly share code, notes, and snippets.

View sushidub's full-sized avatar

jgraston sushidub

View GitHub Profile
@sushidub
sushidub / sqlite_query.sh
Last active July 19, 2022 19:21
Quickly query, update, insert, or delete items within a locally owned sqlite database. Simple, fast, and user friendly. Avoids the sqlite cli. Zero syntax.
#!/bin/bash
#
# @note: WIP!!
# @desc: Quickly perform a series of simple CRUD type actions i.e., query, update, insert, delete
# against a locally owned sqlite database. Assumes one standard integer based 'id' column.
# Optional SQLITE_DB, SQLITE_TBL, SQLITE_INDEX env variables replace the -db, -t, and -c flags
# @why: Because I use several sqlite db's and frequently query and/or update them. I finally got sick of
# invoking the sqlite cli, typing sensitive slq syntax, and wanted to build or use something super
# simple without relying on but Bash functionality.
#
@sushidub
sushidub / bash_strict_mode.md
Created December 12, 2021 15:03 — forked from maxisam/bash_strict_mode.md
set -e, -u, -o, -x pipefail explanation

set -e, -u, -o, -x pipefail

The set lines

  • These lines deliberately cause your script to fail. Wait, what? Believe me, this is a good thing.
  • With these settings, certain common errors will cause the script to immediately fail, explicitly and loudly. Otherwise, you can get hidden bugs that are discovered only when they blow up in production.
  • set -euxo pipefail is short for:
set -e
set -u
@sushidub
sushidub / MakeVSCodeWorkspace.sh
Last active August 19, 2021 23:04
Convert a directory into a VSCode workspace from the macOS command line
#!/usr/bin/env bash
# Convert a directory into a VSCode workspace from the macOS command line
# Usage
# 1. `cd` into a directory containing all the files you'd like to capture within a VSCode workspace
# 2. run `$ MakeVSCodeWorkspace`
# 3. the command will print the following json snippet in a new .code-workspace file
# using the name of the current directory for both the name of the newly created workspace file
# and the 'path' value within
@sushidub
sushidub / Make-VSCode-Project.md
Last active January 12, 2021 15:43
Setup and launch a new VSCode project (workspace) from macOS Finder with one click. Workspace/Project name is derived from the selected folder the action is run against.

Requirements

macOS Automator bin/bash (or any command line flavor that supports printf) VSCode

Installation

  • Download the .workflow file (via Dropbox, and don't worry its code signed)

  • Open Automator - import/open the .workflow file - resave to username/Library/Services folder — or do it all via terminal

@sushidub
sushidub / Build-Notes.md
Last active March 26, 2020 04:16
Notes and quotes on building from source files

When using a gcc based toolchain, be mindful that you should have the autotools installed (autoconf, automake) and will need to run either ./autogen.sh or ./bootstrap.sh to produce the configure file.

The difference between autogen.sh and bootstrap.sh is that the former invokes configure with a default set of options, and will therefore generate a Makefile, whereas the latter does not invoke configure at all. If using autogen.sh, note that you can also append options, that will be passed as is to configure.

source: https://github.com/libusb/libusb/blob/master/README.git

@sushidub
sushidub / INSTALL.md
Last active April 27, 2022 17:40
Building source files using MAKE (autoconf). A readable description and instructions on configuration mechanics (e.g. ./configure).

Installation Instructions


Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation, Inc.

Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind.

@sushidub
sushidub / RGB-HSL-HSV.md
Last active July 19, 2019 23:06
RGB | HSL | HSV | Javascript conversions
/**
 * Converts an RGB color value to HSL. Conversion formula
 * adapted from http://en.wikipedia.org/wiki/HSL_color_space.
 * Assumes r, g, and b are contained in the set [0, 255] and
 * returns h, s, and l in the set [0, 1].
 *
 * @param   Number  r       The red color value
 * @param   Number  g       The green color value
@sushidub
sushidub / certbot-renew.md
Last active February 25, 2019 10:12
AWS EC2 / Certbot / Fix for the Certbot renewal module missing error

Original Issue/Fix

Lately when running certbot renew on my AWS Linux instance produces the following error:

Error: couldn't get currently installed version for /opt/eff.org/certbot/venv/bin/letsencrypt: 
Traceback (most recent call last):
  File "/opt/eff.org/certbot/venv/bin/letsencrypt", line 7, in <module>
    from certbot.main import main
  File "/opt/eff.org/certbot/venv/local/lib/python2.7/dist-packages/certbot/main.py", line 10, in <module>
@sushidub
sushidub / wp-auto-update-settings.md
Last active October 11, 2018 18:48
How to avoid Wordpress automatic updates

Wordpress Automatic Update settings

Paste the following into wp-config.php just above the /* That's all, stop editing! Happy blogging. */ comment at bottom of file. Uncomment whichever of the following rules you want automatic updates from Wordpress to follow.

// =========================
// Blanket disable every single type of automatic update
// =========================
// define( 'AUTOMATIC_UPDATER_DISABLED', true );
@sushidub
sushidub / wp-admin-globals.md
Last active September 12, 2018 05:55
wordpress admin globals

helpful wordpress admin globals available via the window object

var adminScreen = {};
adminScreen.pagenow = window.pagenow;
adminScreen.adminpage = window.adminpage;
adminScreen.typenow = window.typenow;

console.log(adminScreen);