Skip to content

Instantly share code, notes, and snippets.

View burlesona's full-sized avatar

Andrew Burleson burlesona

  • Mercury
  • Denver, CO
View GitHub Profile
@burlesona
burlesona / lookup.rb
Created April 2, 2017 17:37
For GT NS6262 class, a script to get IP addresses from hostnames
require 'resolv'
filename = ARGV[0]
batch_size = ARGV[1].to_i
outfile = File.open('ip-addresses.txt','w+')
domains = File.readlines(filename)
groups = domains.each_slice(batch_size)
threads = []
results = []
groups.each_with_index do |group,index|
@burlesona
burlesona / nginx.conf
Created May 9, 2017 04:48
Default nginx conf. Because these default things can be hard to find.
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
@burlesona
burlesona / console.rb
Created July 18, 2017 20:02
Ruby console file for an app
#!/usr/bin/env ruby
require 'rubygems'
require 'bundler/setup'
require_relative 'environment'
require 'models'
require 'helpers'
require 'pry'
Pry.start self
# Not that this is an impressive demo, but it makes the point that Ruby
# does in fact have the ability to create "pure" functions and pass them
# as arguments to higher order functions. People get hung up on the syntax
# but it's not really that complicated.
make_adder = method def make_adder(num)
->(input){ input + num }
end
make_add_twice = method def make_add_twice(adder, num)