Skip to content

Instantly share code, notes, and snippets.

View scalp42's full-sized avatar
πŸ‘¨β€πŸŽ¨

Anthony Scalisi scalp42

πŸ‘¨β€πŸŽ¨
View GitHub Profile
@scalp42
scalp42 / keystore.rb
Created October 2, 2015 18:30 — forked from solarce/keystore.rb
snippets of how we get rundeck behind nginx+ssl
# Import the self-signed certificate from chef-server for rundeck's store
cert_alias = "#{node['fqdn']}-selfsigned-crt"
execute "import-rundeck-self-signed-cert" do
not_if "keytool -list -keystore /etc/rundeck/ssl/truststore -storepass adminadmin | grep #{cert_alias}"
command "keytool -import -alias #{cert_alias} -file /var/opt/chef-server/nginx/ca/*.crt -keystore /etc/rundeck/ssl/truststore -storepass adminadmin -noprompt"
action :run
end
@scalp42
scalp42 / only-one-active-instance.py
Last active September 18, 2015 22:34 — forked from ketzacoatl/only-one-active-instance.py
Proof of Concept - Docker service orchestration via python consul-lock
import sys
from time import sleep
import consul
import consul_lock
from docker import Client
'''
This is a PoC which uses consul's locking mechanism to ensure only
one instance of the named docker container is running. Requires:
@scalp42
scalp42 / module_function.rb
Last active September 11, 2015 06:03 — forked from ericallam/module_function.rb
Using module_function instead of extend self
# a lot of people in ruby do this
module Foo
extend self
def bar
'bar'
end
end
Foo.bar
@scalp42
scalp42 / vbox_ipaddress.rb
Last active September 2, 2015 23:14 — forked from binamov/vbox_ipaddress.rb
An Ohai 7 plugin that assigns the IP address of eth1 to node.ipaddress attribute (for virtualbox vagrant boxes). It's an Ohai 7 rewrite of this: http://johntdyer.com/blog/2013/01/25/ohai/
Ohai.plugin(:Vboxipaddress) do
provides "ipaddress"
depends "ipaddress", "network/interfaces", "virtualization/system", "etc/passwd"
collect_data(:default) do
if virtualization["system"] == "vbox"
if etc["passwd"].any? { |k,v| k == "vagrant"}
if network["interfaces"]["eth1"]
network["interfaces"]["eth1"]["addresses"].each do |ip, params|
if params['family'] == ('inet')
ipaddress ip
@scalp42
scalp42 / gist:71f4ab146baeb3da041a
Last active August 28, 2015 21:00 — forked from evanphx/gist:358c1627b69f7a33fca6
Tachyon installer with hash verification
curl http://tachyon.vektra.io/install.sh > it.sh && test $(openssl sha1 < it.sh) = "23fb0450b152dfaa8331dd37c3a4c13d4de9dbb8" && bash it.sh
@scalp42
scalp42 / check.rb
Last active August 28, 2015 20:58 — forked from evanphx/check.rb
Ruby "type" checking
def foo(a : String)
# the method prologue is injected with
raise TypeError unless String === a
end
# Allows for other interesting ones, like:
def use_as_number(a : /\d+/)
end
@scalp42
scalp42 / json.conf
Last active August 28, 2015 20:58 — forked from evanphx/json.conf
nginx json access log
log_format json '{'
'"host": "lb01", '
'"status": "$status", '
'"scheme": "$scheme", '
'"uri": "$request_uri", '
'"args": "$args", '
'"dest_host": "$http_host", '
'"content_type": "$sent_http_content_type", '
'"protocol": "$server_protocol", '
'"referer": "$http_referer", '
@scalp42
scalp42 / dump-music
Last active August 28, 2015 20:55 — forked from aphyr/dump-music
#!/usr/bin/env ruby
require 'sequel'
require 'fileutils'
require 'uri'
require 'pp'
def home
ENV['HOME']
end
@scalp42
scalp42 / hash_inverse.rb
Last active August 29, 2015 14:27 — forked from NigelThorne/hash_inverse.rb
ruby hash invert
require './hash_inverse'
describe Hash do
describe "when empty and asked for the inverse" do
it "returns an empty hash" do
{}.inverse.must_equal Hash.new
end
end
describe "when mapping are unique and asked for the inverse" do
@scalp42
scalp42 / configure_proxy_protocol.md
Last active August 29, 2015 14:26 — forked from pablitoc/configure_proxy_protocol.md
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"