Skip to content

Instantly share code, notes, and snippets.

View hannahstwinter's full-sized avatar

Hann Winter hannahstwinter

  • Rackspace
  • Richmond, VA
View GitHub Profile
@hannahstwinter
hannahstwinter / ck.urls.tickets.js
Last active August 2, 2018 22:40
URL functions with queryParam objects for each create URL leveraging BPiT templates
// queryParams = {
// max: this.limitHelper_.getMaxServers(),
// region: this.getSelectedProvider_().getName()
// };
ck.urls.tickets.requestServerLimitIncrease = function (queryParams) {
additionalQueryParams = { 'templateId': 'serverLimitIncrease', 'accountId': ck.UserAccount.accountId() };
return goog.string.subs(
'%s?%s',
ck.urls.tickets.create(),
ck.urls.tickets.getQueryString(queryParams, additionalQueryParams)
@hannahstwinter
hannahstwinter / parse_rake_tasks_from_yml_files.rb
Created March 9, 2018 21:19
Parse rake tasks tied to acceptance tests in our pipeline from our autocreator *.yml files
class AutoCreatorJobFileParser
def initialize(base_path = 'tools/autocreator')
# default base_path is relative path from qetest/pinot/spec/Rakefile
@full_path = "#{base_path}/jobsData/acceptance"
end
def get_acceptance_tests
rake_tasks = []
get_acc_tests_from_files_in_path @full_path, rake_tasks
rake_tasks.compact
@hannahstwinter
hannahstwinter / ticket_w_instance.json
Last active February 16, 2018 18:16
Example Ticket Data with Instance
{
"ticket":{
"category":{
"id":"10",
"name":"Cloud Databases",
"sub-category":{
"id":"33",
"name":"General Support"
}
},
@hannahstwinter
hannahstwinter / ticket_w_product_account_and_attachment.json
Last active February 16, 2018 18:16
Example Ticket Data with Product Account and Attachment
{
"ticket":{
"category":{
"id":"ord-0000026",
"name":"Fanatical Support for AWS",
"sub-category":{
"id":"ord-0000083",
"name":"General"
}
},
@hannahstwinter
hannahstwinter / whoGoes.rb
Last active May 12, 2017 14:58
A silly script to select who on our team goes to the Connect.Conf
def whoGoes
wantsToGo = [ 'Bill', 'Hannah', 'Josh', 'Kevin', 'Nathan', 'Robert' ]
wantsToGo.shuffle.shuffle.shuffle.shuffle.shuffle.shuffle.pop(4)
end
def revealWhoGoes
going = whoGoes
puts ""
puts "And the randomly selected attendees of the CONNECT.CONF in September are..."
puts ""
@hannahstwinter
hannahstwinter / kill_foreman.txt
Last active February 10, 2017 14:08
find and kill all foreman processes
# foreman ports 5000, 5100, 5200, 5300, 5400, 5500
ps aux | grep node | grep -v "grep" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9
ps aux | grep plovr | grep -v "grep" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9
ps aux | grep grunt | grep -v "grep" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9
ps aux | grep HTTPServer | grep -v "grep" | tr -s ' ' | cut -d ' ' -f 2 | xargs kill -9
@hannahstwinter
hannahstwinter / binarysearch.rb
Created September 17, 2013 23:22
Binary Search exploration, part... well... one. Likely one of one.
class BinarySearch
def has_num?(num, array)
num_index(num, array) != nil ? true : false
end
def num_index(num, array)
hi = array.length - 1
lo = 0
while lo <= hi
@hannahstwinter
hannahstwinter / wquickunion.rb
Created August 30, 2013 17:38
Union Find exploration, part 3: Weighted Quick Union w/ Path Compression
class WeightedQuickUnionUF
def initialize(n)
@n = n
@num_to_id = Hash[((1..n).to_a).zip((1..n).to_a)]
@size = Hash[((1..n).to_a).zip((1..n).to_a)]
end
def root(x)
while x != @num_to_id[x]
@hannahstwinter
hannahstwinter / quickunion.rb
Created August 30, 2013 17:37
Union Find exploration, part 2: Quick Union
class QuickUnion
def initialize(n)
@n = n
@num_to_id = Hash[((1..n).to_a).zip((1..n).to_a)]
end
def root(x)
x = @num_to_id[x] while x != @num_to_id[x] # chase root of x to parent root
return x
@hannahstwinter
hannahstwinter / quickfind.rb
Created August 30, 2013 17:35
Union Find exploration, part 1: Quick Find
class QuickFind
def initialize(n)
@n = n
@num_to_id = Hash[((1..n).to_a).zip((1..n).to_a)]
end
def union(x,y)
xid = @num_to_id[x]
yid = @num_to_id[y]