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
@wakproductions
wakproductions / node_cheat_sheet.md
Last active January 18, 2018 20:25
Node.js Cheat Sheet

Useful Modules

  • formidable - for receiving forms and HTTP files
  • nodemailer - email
  • standard - code linter
  • passport - equivalent of Devise
  • knex -> Ruby Arel?
  • sequelize -> ORM like ActiveRecord? (how does it interface with Knex?)
  • Gulp -> ???
  • nodemon -> Ruby guard?
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@wakproductions
wakproductions / elixir_learning.md
Last active April 26, 2017 01:58
Learning Elixir

Things that jumped out at me while learning Elixir

Cons operator

In addition to the aforementioned functions, you can use pattern matching and the cons operator | to split a list into head and tail; we’ll learn more about this pattern in later lessons:

iex> [h|t] = [3.14, :pie, "Apple"]
[3.14, :pie, "Apple"]
iex&gt; h
@wakproductions
wakproductions / elixir_cheat_sheet.md
Last active April 29, 2017 17:06
Elixir Cheat Sheet

Function syntaxes

def myfunc(a,b) do
  a + b
end

lambda:
myfunc = fn a, b -> a + b end
myfunc.() # this is one way to call a lambda
@wakproductions
wakproductions / postgres_cheat_sheet.md
Last active August 14, 2017 19:30
Postgres Cheat Sheet

Restart Postgres (on Linux core installation via apt)

sudo service postgresql restart

Show databases

wkotzan=# \l
@wakproductions
wakproductions / instance-name-tag.sh
Created April 11, 2017 19:41 — forked from swithrow/instance-name-tag.sh
EC2 Instance Name Tag in the bash prompt.
#!/bin/bash
#
# copy this into /etc/profile.d/instance-name-tag.sh
#
# you will need:
# - curl, jq, and aws cli installed
# - an IAM role that gives the EC2 instance access to describe tags
#
@wakproductions
wakproductions / redis_cheat_sheet.md
Last active April 12, 2017 14:17
Redis Cheat Sheet

Server Setup

  • The IP Address binding needs to be set in the /etc/redis/redis.conf for it to be available.

Start Server

sudo service redis-server start
@wakproductions
wakproductions / rails_cheat_sheet.md
Last active June 5, 2017 19:57
Rails Cheat Sheet

Show ActiveRecord SQL

Sometimes SQL doesn't show up in test environment or development. This turns it back on:

ActiveRecord::Base.logger = Logger.new(STDOUT)

Rails Database Config

config = Rails.configuration.database_configuration
@wakproductions
wakproductions / linux_cheat_sheet.md
Last active September 22, 2017 14:20
Linux Commands Cheat Sheet

File System

chmod & chown

chmod: 1=x, 2=w, 4=r

chmod (user)(group)(other) chmod 730 # only the user can rwx, read permission to the group or other

chown owner:group file