Skip to content

Instantly share code, notes, and snippets.

View shamil614's full-sized avatar

scott hamilton shamil614

View GitHub Profile
@shamil614
shamil614 / search_bundler_version.sh
Created January 15, 2020 22:31
install bundler from gemfile.lock
gem install bundler -v $(cat Gemfile.lock | grep -A1 "BUNDLED WITH" | tail -n 1 | xargs)
@shamil614
shamil614 / no_publishers.json
Created August 9, 2019 16:46
Janus Admin Panel No Publishers
{
"session_id": 7621671552239865,
"session_last_activity": 50548431047,
"session_transport": "janus.transport.websockets",
"handle_id": 6462710068811725,
"loop-running": true,
"created": 50218045447,
"current_time": 50554957482,
"plugin": "janus.plugin.videoroom",
"plugin_specific": {
@shamil614
shamil614 / thread_queue.rb
Created February 8, 2017 22:26
thread queue example
require "thread"
require "awesome_print"
start_time = Time.now
results = { body: [] }
queue = Queue.new
0..50.times { |x| queue.push x }
@shamil614
shamil614 / math.exs
Created November 29, 2016 17:36
Learn Elixir Episode 06
defmodule Math do
def sum(list) do
sum(list, 0)
end
def sum([], 0), do: 0
def sum([], total) when total > 0, do: total
def sum(list, total) do
@shamil614
shamil614 / logstash.rb
Created June 10, 2016 16:57
Snipped of how Logstash is setup
require "logstash-logger"
# Sensible configuration options that we want to share accross ENVs
Rails.application.configure do
# Logstash has a bunch more config options that have sensible defaults.
config.logstash.uri = ENV["LOG_SERVER"]
# Use the lowest log level to ensure availability of diagnostic information
# when problems arise.
config.log_level = ENV["LOG_LEVEL"] || :info
@shamil614
shamil614 / config.exs
Last active November 11, 2015 16:06
Override Dogma LineLength
# Keep your sanity by making a simple change to Dogma config.
# Known to be compatible with v0.0.11
# Override the default 80 for max_length and set it to 120
config :dogma,
rule_set: Dogma.RuleSet.All,
override: %{ LineLength => [ max_length: 120 ] }
@shamil614
shamil614 / docker_scripts.sh
Last active December 4, 2015 17:41
Quick and dirty bash scripts to streamline repetitive tasks.
#!/bin/bash
# Instructions
# 1. Download to ~/scripts
# 2. chmod u+x ~/scripts/docker_scripts.sh
# 3. Add the /scripts into your PATH by including this in your ~/.bashrc `export PATH="$PATH:/$HOME/scripts"`
# 4. Open a new terminal and execute `docker_scripts.sh`
# 5. Choose from any of the options at the prompt
function stop_containers() {
id=$(docker ps | awk 'NR > 1 {print $1}' | tr '\n' ' ')
@shamil614
shamil614 / en.yml
Created November 18, 2014 21:06
Demo how to use localize ActiveRecord errors
en:
helpers:
submit:
offer:
create: "Make Offer"
bid:
create: "Place Bid"
activerecord:
errors:
models:
@shamil614
shamil614 / redis.conf
Created October 16, 2014 23:48
Basic Redis Config (development)
loglevel notice
logfile ""
dir vendor/redis/db/
// job quote make the following assumptions:
// 1 hr job during the week (normal/standard rate)
// travel costs are included
// includes interp minimum job hours (some interps have a requirement for two hours)
// does not include tax
{ "job_quote": { "min_cost": "$20", "max_cost": "$65" }
"interpreters":
[
{ "cityState": "Austin, TX 78758", "latitude": 123.456, "longitude": 123.456, "hourlyRate": "$45" },
{ "cityState": "San Antonio, TX 77577", "latitude": 456.789, "longitude": 456.789, "hourlyRate": "$65" },