Skip to content

Instantly share code, notes, and snippets.

View igolden's full-sized avatar
🎯
Focusing

Ian Golden igolden

🎯
Focusing
View GitHub Profile
@igolden
igolden / node-drawille-bar-graph.js
Created December 30, 2021 22:26
Generate a bar graph from a row of tabular data in the terminal
const Canvas = require("./");
const canvas = new Canvas();
c = canvas.getContext("2d");
const ROWDATA = [213, 398, 12, 334, 102, 499, 60, 230, 222];
function draw() {
let cols = 6;
let rows = 10;
@igolden
igolden / README.md
Last active December 27, 2021 19:46
Basic cli loaders via process.stdout -- nodejs

Basic Nodejs Loaders

Use process.stdout to "rewrite" stdout and simulate a loader.

  • Dots - basic ... loader
  • Stars - animate an 8 frame circle loader
  • Progress Bar - simulate % completion
@igolden
igolden / strftime.txt
Created September 13, 2021 22:04
Strftime cheatsheet from rubydocs
%Y%m%d => 20071119 Calendar date (basic)
%F => 2007-11-19 Calendar date (extended)
%Y-%m => 2007-11 Calendar date, reduced accuracy, specific month
%Y => 2007 Calendar date, reduced accuracy, specific year
%C => 20 Calendar date, reduced accuracy, specific century
%Y%j => 2007323 Ordinal date (basic)
%Y-%j => 2007-323 Ordinal date (extended)
%GW%V%u => 2007W471 Week date (basic)
%G-W%V-%u => 2007-W47-1 Week date (extended)
%GW%V => 2007W47 Week date, reduced accuracy, specific week (basic)
import java.sql.*;
import java.util.*;
class Main {
public static void main(String[] args) {
try {
// Connections
@igolden
igolden / i3-config
Created August 1, 2019 00:08
Install i3-gaps
# This file has been auto-generated by i3-config-wizard(1). # It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout some time, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see https://i3wm.org/docs/userguide.html for a complete reference!
@igolden
igolden / traverse.rb
Created March 5, 2019 15:54
Traverse and rename files to slugs
##
# Traverse and rename files
#
# - needs cleanup
require 'shellwords'
path = "src/assets/images/catalog"
folders = Dir.entries(path)
@igolden
igolden / deploy.sh
Created September 20, 2018 20:24
Deploy an s3 website easily
set -e;
# Options
#======================================
# Warnings cause build failures
# if CI=true.
export CI=false
PROFILE=default
@igolden
igolden / gist:35cb5de183b2775e3f8ca620eaa8f3ec
Created September 20, 2018 17:13
Setup bastion host for ec2 (still requires some manual setup after)
#!/bin/bash
apt-get update && apt-get upgrade -y
apt-get install -y vim nmap curl wget build-essential nginx zsh
mkdir /home/sysadmin
cat > /home/sysadmin/.zshrc <<EOF
setopt promptsubst
@igolden
igolden / gist:e652e9e7a4b640a15c9b0b1abaf88fc0
Created September 19, 2018 04:31
Import keys reference
# Download keys from HD
gpg --import secure@igolden.pubkey secure@igolden.privkey
@igolden
igolden / run.sh
Created September 17, 2018 15:40
docker-compose wrapper for running commands. Drop this in your bin folder
#!/usr/bin/env bash
##
# bin/run
# author: Ian Golden <ian@iangolden.com>
#
#
# Simple bash script to wrap the docker-compose run
# prefix for running commands in a dockerized rails
# setup. prefixes with docker-compose run bundle