Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Ian Golden igolden

🎯
Focusing
View GitHub Profile
@igolden
igolden / strftime.txt
Created Sep 13, 2021
Strftime cheatsheet from rubydocs
View strftime.txt
%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)
View update-record.java
import java.sql.*;
import java.util.*;
class Main {
public static void main(String[] args) {
try {
// Connections
@igolden
igolden / i3-config
Created Aug 1, 2019
Install i3-gaps
View i3-config
# 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 Mar 5, 2019
Traverse and rename files to slugs
View traverse.rb
##
# Traverse and rename files
#
# - needs cleanup
require 'shellwords'
path = "src/assets/images/catalog"
folders = Dir.entries(path)
@igolden
igolden / deploy.sh
Created Sep 20, 2018
Deploy an s3 website easily
View deploy.sh
set -e;
# Options
#======================================
# Warnings cause build failures
# if CI=true.
export CI=false
PROFILE=default
@igolden
igolden / gist:35cb5de183b2775e3f8ca620eaa8f3ec
Created Sep 20, 2018
Setup bastion host for ec2 (still requires some manual setup after)
View gist:35cb5de183b2775e3f8ca620eaa8f3ec
#!/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
View gist:e652e9e7a4b640a15c9b0b1abaf88fc0
# Download keys from HD
gpg --import secure@igolden.pubkey secure@igolden.privkey
@igolden
igolden / run.sh
Created Sep 17, 2018
docker-compose wrapper for running commands. Drop this in your bin folder
View run.sh
#!/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
@igolden
igolden / setup_hosts.sh
Created Sep 17, 2018
Sets up dev server hostname for local machine
View setup_hosts.sh
#!/usr/bin/env bash
FILE='/etc/hosts'
printf "Name your project (lowercase, no-spaces): \n"
read NAME
function setup_namespace {
sed -i .bak -e "s/project/$NAME/g" config/nginx.conf && rm config/*.bak
@igolden
igolden / run
Created Nov 4, 2017
Drop this in your bin folder if you're using rails and docker-compose
View run
#!/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