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 / 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"}
}
}
},