Skip to content

Instantly share code, notes, and snippets.

View randysecrist's full-sized avatar

Randy Secrist randysecrist

View GitHub Profile
@randysecrist
randysecrist / gitlab_prune_artifacts.rb
Created November 10, 2020 17:42
clean gitlab artifacts
#! /usr/bin/ruby
begin
require 'net/http'
require 'json'
rescue LoadError
puts 'Required dependencies are not installed. Please install the following:'
puts '\'net/http\', \'json\''
puts 'Then try again.'
exit
@randysecrist
randysecrist / cities.py
Last active March 21, 2018 17:12 — forked from Miserlou/gist:11500b2345d3fe850c92
1000 Largest US Cities By Population
Largest 1000 Cities in America
2017 popuation data - Biggest US Cities By Population
rank,city,state,population,2000-2016 growth
1,New York,New York,8537673,6.5%
2,Los Angeles,California,3976322,7.3%
3,Chicago,Illinois,2704958,-6.5%
4,Houston,Texas,2303482,16.4%
5,Phoenix,Arizona,1615017,21.7%
@randysecrist
randysecrist / gist:3994357
Created November 1, 2012 15:33
network restart?
root@psra-haproxy:~# /etc/init.d/bprobe start
* Starting Boundary flow meter bprobe 01/Nov/2012 15:30:29 [nprobe.c:1576] Resolving IP address for "collector.boundary.com"...
01/Nov/2012 15:30:29 [nprobe.c:1598] collector.boundary.com resolved to 206.80.62.21
01/Nov/2012 15:30:29 [nprobe.c:2096] Exporting from: 10.1.2.16
01/Nov/2012 15:30:29 [nprobe.c:1678] Loading certificate: /etc/bprobe/cert.pem
01/Nov/2012 15:30:29 [nprobe.c:1688] Loading private key /etc/bprobe/key.pem
01/Nov/2012 15:30:29 [nprobe.c:1698] Loading CA /etc/bprobe/ca.pem
01/Nov/2012 15:30:29 [nprobe.c:1708] TLS initialized
01/Nov/2012 15:30:29 [nprobe.c:1756] TLS connected
01/Nov/2012 15:30:29 [nprobe.c:2123] Exporting flows towards tls://collector.boundary.com:4740 using TLS
@randysecrist
randysecrist / gist:3906910
Created October 17, 2012 17:32
siblings & ripple
1) Error:
test_counter_operations(TestExample):
NoMethodError: undefined method `key' for #<Riak::RContent:0x007fde03b79420>
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/document/finders.rb:121:in `block in instantiate'
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/document/finders.rb:120:in `tap'
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/document/finders.rb:120:in `instantiate'
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/attribute_methods/dirty.rb:13:in `instantiate'
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/conflict/resolver.rb:53:in `document'
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/bundler/gems/ripple-c68106a8a431/lib/ripple/conflict/basic_resolver.rb:4:in `documen
@randysecrist
randysecrist / gist:3794876
Created September 27, 2012 16:13
chef ordering
# somewhere above; like in a template definition
notifies :restart, resources(:service => "redis-server")
# later on in the same recipe
service "redis-server" do
supports :start => true, :stop => true, :restart => true, :"force-reload" => true
action [ :enable, :start ]
end
we get an error that says something about the 'redis-server' service not yet defined (as it is referenced in the template).
@randysecrist
randysecrist / rc_v2.rb
Created July 20, 2012 17:14
illustrate decryption issue / possible edge case / starting with regular json
context "multi-json exception" do
setup do
@encryptor = Ripple::Contrib::EncryptedSerializer.new(OpenSSL::Cipher.new("AES-256-CBC"))
@encryptor.key = 'mhealth123456789101112mhealth123'
end
should "decrypt using aes encryptor" do
input = File.read("test/fixtures/test_document/v2_error.txt")
input = JSON.parse(input)
expected = YAML.dump(input)
@randysecrist
randysecrist / 2i_key_test.rb
Created July 17, 2012 16:46
simple 2i test that should print true 5 times in leveldb, but only 4 times with memory backend.
require 'riak'
c = Riak::Client.new(:nodes => [{:host => 'localhost', :http_port => 8091}])
b = c.bucket('foo')
ro1 = b.get_or_new('one')
ro1.raw_data = "Hello, world!"
ro1.content_type = "text/html"
ro1.indexes['date_bin'] << '2012-07-13'
ro1.store
[randy|Bashos-MacBook-Pro|1.9.3p125 (dev) ✗] ~/Documents/dev/views/mhealth/mhealth $ bundle exec rake
/Users/randy/.rbenv/versions/1.9.3-p125/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake/alt_system.rb:32: Use RbConfig instead of obsolete and deprecated Config.
(in /Users/randy/Documents/dev/views/mhealth/mhealth)
Pending scenario: the api doesn't credentials for the access token request (in test/integration/api_test.rb:44)
Pending scenario: the api sends wrong credentials for the access token request (in test/integration/api_test.rb:49)
Pending scenario: user denies authorization request (in test/integration/authorization_test.rb:157)
Pending scenario: authorization request has state (in test/integration/authorization_test.rb:160)
Pending scenario: authorization request redirect_uri has a query string (in test/integration/authorization_test.rb:163)
Pending scenario: authorization request has state & redirect_uri w/ query string (in test/integration/authorization_test.rb:166)
Pending scenario: user authorizes
@randysecrist
randysecrist / ripple.rb
Created May 9, 2012 02:39
handy ripple helper function
module Ripple
module Document
module Finders
module ClassMethods
def find_by(key, query)
find(find_keys_by(key, query)).compact
end
def find_keys_by(key, query)
if key == "$key" || key == "$bucket"
@randysecrist
randysecrist / mhealth_dev_setup
Created March 12, 2012 12:53
Setup Development Environment for mHealth
Test Case Steps
---------------
1. OS X 10.7.3 - Fresh Install
2. Install XCode 4.3
3. Install Comand Line Tools for XCode
a. XCode -> Open Developer Tool -> More Developer Tools -> Command Line Tools.dmg
4. Install Erlang viw SpawnGrid / Kerl
a. add kerl to path
b. kerl build R14B04 r14b04