Skip to content

Instantly share code, notes, and snippets.

@pablitoc
pablitoc / merge.md
Created December 6, 2013 22:22 — forked from jt/merge.md

If someone forks a gist and you'd like to merge their changes. Do this:

  1. clone your repo, I use the name of the gist

     git clone git://gist.github.com/1163142.git gist-1163142
    
  2. add a remote for the forked gist, I'm using the name of my fellow developer

     git remote add aaron git://gist.github.com/1164196.git
    
sudo su -
# stuff we need to build from source
apt-get install libpcre3-dev build-essential libssl-dev
# get the nginx source
cd /opt/
wget http://nginx.org/download/nginx-0.8.54.tar.gz
tar -zxvf nginx*
# we'll put the source for nginx modules in here
@pablitoc
pablitoc / unicorn.rb
Created August 22, 2014 19:12
Unicorn Config
require 'dotenv'
worker_processes Integer(ENV['WEB_CONCURRENCY'] || 3)
timeout 15
preload_app true
stderr_path "/srv/#{application}/shared/log/"ENV['RAILS_ENV']".log"
stdout_path "/srv/#{application}/shared/log/"ENV['RAILS_ENV']".log"
pid "/srv/#{application}/shared/tmp/pids/#{application}.pid"
@pablitoc
pablitoc / 0_reuse_code.js
Last active August 29, 2015 14:06
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@pablitoc
pablitoc / configure_proxy_protocol.md
Last active April 12, 2023 15:21
Configuring Proxy Protocol

##Install AWS CLI Tools##

  1. Install AWS CLI Tools. You can also use the EC2 API Tool if you are more comfortable with them. But this write-up uses the EC2 CLI.
  2. Create a user via Amazon IAM or download the security accessID and securitykey you will need it to query Amazon CLI.
  3. using Terminal cd into .aws directory cd ~/.aws edit or create new file named config paste the following contents inside.
    `[default]`
    `aws_access_key_id = ACCESS_ID`
    `aws_secret_access_key = SECRET_ID`
    `output = json OR bson OR text`
    `region = PREFERRED_AWS_REGION`

Save the file as "config"

@pablitoc
pablitoc / Pfx-convert-key.md
Last active March 10, 2017 00:27
Export CRT & Key from pfx file

In this article I’m going to show you the commands you need to convert your .PFX Certificate file to a seperate certificate and keyfile. This article can come in handy when you need to import your certificates on devices like Cisco routers/loadbalancers etc. where you probably need to import the certificates and keyfiles in plain text (unencrypted). My tool of choice (but there might be others) is OpenSSL for Windows, which can be downloaded here

So after you installed OpenSSL you can start it from it’s Bin folder. I’d like to put OpenSSL\Bin in my path so I can start it from any folder. Fire up a command prompt and cd to the folder that contains your .pfx file. First type the first command to extract the private key:

openssl pkcs12 -in [yourfile.pfx] -nocerts -out [keyfile-encrypted.key]

What this command does is extract the private key from the .pfx file. Once entered you need to type in the importpassword of the .pfx file. This is the password that you used to protect your keypair when yo

@pablitoc
pablitoc / mongo_backup.sh
Created March 3, 2016 21:10
mongo_backup.sh
#!/bin/sh
#ENV Variables
MONGO_HOST=
MONGO_PORT=
MONGO_DB_NAME=
MONGO_USERNAME=
MONGO_PASSWORD=
APP_PATH=
APP_NAME=
# Use Boto 3 and Botocore modules
import sys, threading, botocore
import boto3
from boto3.s3.transfer import TransferConfig
# Create Connection to S3
s3_client = boto3.client('s3')
# Create Connection to S3
s3_bucket = boto3.resource('s3')
@pablitoc
pablitoc / git.migrate
Created December 15, 2016 20:31 — forked from niksumeiko/git.migrate
Moving git repository and all its branches, tags to a new remote repository keeping commits history
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
### Step 1. Make sure you have a local copy of all "old repo"
### branches and tags.