Skip to content

Instantly share code, notes, and snippets.

View jamesmoriarty's full-sized avatar
🔮
0xc0000005

James Moriarty jamesmoriarty

🔮
0xc0000005
View GitHub Profile
@chhibber
chhibber / gist:8414078
Created January 14, 2014 06:35
AWS - NAT Bootstrap Example
#!/bin/bash -
#===============================================================================
# vim: softtabstop=4 shiftwidth=4 expandtab fenc=utf-8 spell spelllang=en
#===============================================================================
set -x
SALT_BOOTSTRAP_SCRIPT="salt-bootstrap.sh"
SALT_BOOTSTRAP_DOWNLOAD="http://bootstrap.saltstack.org"
exec 2>&1 > /tmp/awsbootstrap.log
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@pcreux
pcreux / postgres-is-not-happy.md
Created May 1, 2014 22:49
Repair postgres (homebrew) after a system crash

When my mac crashes and Postgres doesn't boot properly I see the following errors in /usr/local/var/postgres/server.log

FATAL:  lock file "postmaster.pid" already exists

# and / or

lock file "/var/pgsql_socket/.s.PGSQL.5432.lock" already exists

Here are the commands to put Postgres back on track:

@jamesmoriarty
jamesmoriarty / Vagrantfile
Created September 27, 2014 05:18
Vagrant, Ansible, Rbenv and Ruby on Rails
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.network :forwarded_port, guest: 3000, host: 3000
config.vm.box = "precise"
@jbardin
jbardin / proxy_copy.go
Last active June 28, 2023 22:12
Go TCP Proxy pattern
package proxy
import (
"io"
"log"
"net"
)
func Proxy(srvConn, cliConn *net.TCPConn) {
// channels to wait on the close event for each connection
@tuxfight3r
tuxfight3r / tcp_flags.txt
Last active May 22, 2024 02:24
tcpdump - reading tcp flags
##TCP FLAGS##
Unskilled Attackers Pester Real Security Folks
==============================================
TCPDUMP FLAGS
Unskilled = URG = (Not Displayed in Flag Field, Displayed elsewhere)
Attackers = ACK = (Not Displayed in Flag Field, Displayed elsewhere)
Pester = PSH = [P] (Push Data)
Real = RST = [R] (Reset Connection)
Security = SYN = [S] (Start Connection)
@solnic
solnic / active-rom.rb
Created January 29, 2015 21:06
ActiveROM ;)
require 'rom-sql'
require 'virtus'
module ActiveRecord
class Base
def self.inherited(klass)
rel_class = Class.new(ROM::Relation[:sql]) {
base_name Inflecto.tableize(klass.name).to_sym
}
dataset = repository.dataset(rel_class.base_name)
@bethesque
bethesque / hipster-batch-in-ruby.md
Last active May 2, 2016 07:02
A way to write a hipster batch microservice in Ruby
  1. Identify the steps in the high level process

    eg.

    • Step 1: Download CSV files from box
    • Step 2: Convert CSV to JSON
    • Step 3: Upload JSON and CSV files to S3
  2. Create modules for each of those steps. In our use case, the top level process matches a pattern called "ETL" or "Extract, Transform, Load", so we used those names.

@r3wt
r3wt / gist:83629275bd3a153915ef
Last active January 24, 2018 12:21
Rollback hhvm on ubuntu
1. go to http://dl.hhvm.com/ubuntu/pool/main/h/hhvm/ and right click and copy the link to the version of hhvm you want to rollback to
2. sudo apt-get autoremove hhvm -y
3. wget <link you just copied>
4. sudo dpkg -i <name of file u just downloaded>
5. apt-get install -f
6. service hhvm start
Edit: Don't worry when it errors out on step 4. that is expected. just continue to step 5.