Skip to content

Instantly share code, notes, and snippets.

View wakproductions's full-sized avatar
💭
Hey, I'm working on it!

Winston Kotzan wakproductions

💭
Hey, I'm working on it!
View GitHub Profile
module WAKUtils
def self.reload(require_regex)
$".grep(/#{require_regex}/).each {|e| $".delete(e) && require(e) }
end
end
@wakproductions
wakproductions / sql_exercises.md
Last active August 10, 2016 03:59
KSM Consulting SQL Exercises

SQL Exercise #1

At this link <omitted> is a tab-delimited text file containing a list of members of the 114th Congress. Use these names for the following exercise. Import the list of names into a database - Oracle, SQL Server, or HANA. (PostgreSQL was used instead due to its similarity to the selections given. The other options were not readily available.)

Create a list of all possible three-letter combinations (“trigrams”), from ‘AAA’ to ‘ZZZ’, in order, with an ID column. ‘AAA’ gets ID = 1.

Parse each last name into a set of trigrams; e.g., “Brandt” contains BRA, RAN, AND, and NDT. Determine the five most common trigrams in the Congressional roster. For each last name, sum the ID values of its trigrams and determine the last names with the five highest scores.

@wakproductions
wakproductions / docker_cheat_sheet.md
Last active September 20, 2017 20:46 — forked from dvdasari/gist:439ce7c1814c2392c3bf
Docker Commands Cheat Sheet

Base commands:

Creating a new container

docker run [-d (runs in background] [-p <host-system-port>:<container-port>] <image:tag>
* Creates a new container from an image
* If you run it 4 times, it will create 4 containers
Options:
 --name Give the container a name, otherwise it will pick a default name.
@wakproductions
wakproductions / tmux_cheat_sheet.md
Last active December 5, 2016 16:20
TMux Cheat Sheet
tmux list-sessions
  • What happens if you have a tmux session running remotely and disconnect/forget about it? Can it run indefinitely? Yes it can, it will keep that session alive.

Start a new session

tmux new -s session-name

@wakproductions
wakproductions / graylog_cheat_sheet.md
Last active December 9, 2019 00:00
Graylog Cheat Sheet

Docker commands:

$ docker run --name fin-graylog-mongo -d mongo:3
$ docker run --name fin-graylog-elasticsearch -d elasticsearch:2 elasticsearch -Des.cluster.name="graylog"
$ docker run --name fin-graylog-server --link fin-graylog-mongo:mongo --link fin-graylog-elasticsearch:elasticsearch -d -e GRAYLOG_WEB_ENDPOINT="http://127.0.0.1:9000/api" -e GRAYLOG_REST_TRANSPORT_URI='http://127.0.0.1:12900' -p 9000:9000 -p 12900:12900 graylog2/server

Graylog2/graylog2-server#1908 The purpose of GRAYLOG_PASSWORD_SECRET is also under-documented and there should be a suggestion to use pwgen -N 1 -s 96 in the docker documentation (or the whole thing should be initialized on first boot with a random seed without user intervention)

@wakproductions
wakproductions / mariadb_cheat_sheet.md
Last active September 8, 2022 03:21
MariaDB/Mysql Cheat Sheet
@wakproductions
wakproductions / aws_cheat_sheet.md
Last active September 19, 2016 19:16
AWS Cheat Sheet

AWS Services List

  • EC2 - First service, spin up a box on the web
  • Elastic Beanstalk - adds a layer of automation for EC2 by configuring the environment with it (Ruby, Docker, Go, PHP, etc)
  • Lambda - used for event scheduling
  • Simple Workflow Service (SWF) - build, run, and scale background jobs that have parallel or sequential steps

Potential Cron Replacements

@wakproductions
wakproductions / sidekiq_cheat_sheet.md
Last active August 11, 2024 07:21
Sidekiq Commands Cheat Sheet
@wakproductions
wakproductions / vim_cheat_sheet.md
Last active March 9, 2017 21:04
VIM Cheat Sheet

Show line numbers: :set number

Reading a very large file

SO: How to edit multi gigabyte text files in vim

Vim will hang if you try to open up a multi-gigabyte file because it is trying to load the whole thing into a buffer. Ctrl-C will stop file load. If the file is small enough you may have been lucky to have loaded all the contents and just killed any post load steps. Verify that the whole file has been loaded when using this tip.

Vim can handle large files pretty well. I just edited a 3.4GB file, deleting lines, etc. Three things to keep in mind:

@wakproductions
wakproductions / ansible_notes.md
Last active February 28, 2017 03:55
Ansible Notes

Ansible Examples Repository

To see what hosts would be affected by a playbook before you run it, you can do this:

ansible-playbook playbook.yml --list-hosts

Run Ansible playbook

ansible-playbook -i hosts site.yml