Skip to content

Instantly share code, notes, and snippets.

@adriagalin
adriagalin / tmux.cheat
Last active August 29, 2015 14:16 — forked from afair/tmux.cheat
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@adriagalin
adriagalin / move_to_rds.rb
Last active March 28, 2016 17:19 — forked from guenter/move_to_rds.rb
Move to RDS
require 'fileutils'
start_time = Time.now
SOURCE_DB = {
:name => 'db_name',
:user => 'db_user',
:password => 'db_pass',
:host => 'localhost'
@adriagalin
adriagalin / deps.rb
Last active March 28, 2016 17:22 — forked from maxim/deps.rb
Print Ansible role dependencies
#!/usr/bin/env ruby
require 'yaml'
PLAYS_DIR = '.'
ROLES_DIR = './roles'
def deps_of(role)
dep_path = File.join(ROLES_DIR, "#{role}/meta/main.yml")
File.exists?(dep_path) ? (YAML.load_file(dep_path)['dependencies'] || []) : []
@adriagalin
adriagalin / log_generator.rb
Last active March 28, 2016 17:23
Log generator
#!/usr/bin/env ruby
period = ARGV[0]
while true
f = File.open("access.log", "a")
value = ["GET", "POST"].sample
output = "#{Time.now.strftime("%T")} #{value} /test/test/test.html"
f.puts output
puts output
f.close
sleep(period.to_f)
@adriagalin
adriagalin / group_by_month_total_chart
Last active March 28, 2016 17:23
Group totals by month
def self.group_by_month_total_chart
project = {"$project" =>
{
"total" => 1,
"new_created" =>
{
"mo" => {"$month" => "$invoice_date"}
}
}
},
@adriagalin
adriagalin / install-comodo-ssl-cert-for-nginx.rst
Created June 7, 2016 14:06 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@adriagalin
adriagalin / gist:c93ffd615359f22920bde899ef03f8d2
Created March 18, 2017 21:38 — forked from ruckus/gist:2293434
Basic setup of WAL-E for continuous archiving and recovery

WAL-E needs to be installed on all machines, masters and slaves.

How to install WAL-E

Only one machine, the master, writes WAL segments via continuous archiving. The configuration for the master postgresql.conf is:

archive_mode = on
archive_command = 'envdir /etc/wal-e.d/env wal-e wal-push %p'
archive_timeout = 60
@adriagalin
adriagalin / rails-postgres-bootstrap.md
Created February 5, 2018 18:03
Instructions to create a new app using Ruby on Rails, Postgresql and Twitter Bootstrap

Note: I'm using RVM as my ruby version manager, also yo could use rbenv

  • Check ruby version
ruby -v
  • To update ruby
rvm install ruby --latest OR rvm install ruby 2.5.0
@adriagalin
adriagalin / docker-gc
Created February 6, 2018 14:51 — forked from osiyuk/docker-gc
free up disk space after docker garbage
#!/bin/bash
GARBAGE="/var/lib/docker/aufs/diff"
du -hd 1 $GARBAGE | sort -hrk 1 | head -25
find $GARBAGE -maxdepth 1 -name *-removing -exec rm -rf '{}' \;
@adriagalin
adriagalin / Google-Cloud-SDK-commands.md
Last active March 21, 2018 16:46
Google Cloud SDK commands

Google Cloud SDK

Add new config

gcloud init

List configs

gcloud config configurations list