I hereby claim:
-
I am kimtrijnh on github.
-
I am kim111 (https://keybase.io/kim111) on keybase.
-
I have a public key ASAeIeMXNnMROye7TEMoeVBxyWSVVLfjPmSpPeRf0p7I2Ao
| #!/usr/bin/python | |
| import socket #for sockets | |
| import sys #for exit | |
| try: | |
| #create an AF_INET, STREAM socket (TCP) | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| except socket.error, msg: | |
| print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1] |
| set ignorecase | |
| set smartcase | |
| set scrolloff=3 " 3 lines above/below cursor when scrolling | |
| " Emulated Plugins | |
| set surround | |
| " Copy to system clipboard as well | |
| set clipboard+=unnamed |
| #!/bin/bash | |
| function safe_curl() { | |
| # call this with a url argument, e.g. | |
| # safecurl.sh "http://eureka.test.cirrostratus.org:8080/eureka/v2/apps/" | |
| # separating the (verbose) curl options into an array for readability | |
| hash curl 2>/dev/null || { echo >&2 "I require curl but it's not installed. Aborting."; exit 1; } | |
| hash jq 2>/dev/null || { echo >&2 "I require jq but it's not installed. Aborting."; exit 1; } | |
| hash sed 2>/dev/null || { echo >&2 "I require sed but it's not installed. Aborting."; exit 1; } |
| def self.uniq! queue_name | |
| seen_already = Set.new | |
| Sidekiq::Queue.new(queue_name).each { |job| | |
| key = { job.klass => job.args } | |
| key.in?(seen_already) ? job.delete : seen_already << key | |
| } | |
| end |
| class ActiveRecord::Base | |
| def self.import!(record_list) | |
| raise ArgumentError "record_list not an Array of Hashes" unless record_list.is_a?(Array) && record_list.all? {|rec| rec.is_a? Hash } | |
| return record_list if record_list.empty? | |
| (1..record_list.count).step(1000).each do |start| | |
| key_list, value_list = convert_record_list(record_list[start-1..start+999]) | |
| sql = "INSERT INTO #{self.table_name} (#{key_list.join(", ")}) VALUES #{value_list.map {|rec| "(#{rec.join(", ")})" }.join(" ,")}" | |
| self.connection.insert_sql(sql) |
| stats = Sidekiq::Stats.new | |
| stats.queues | |
| stats.enqueued | |
| stats.processed | |
| stats.failed |
I hereby claim:
I am kimtrijnh on github.
I am kim111 (https://keybase.io/kim111) on keybase.
I have a public key ASAeIeMXNnMROye7TEMoeVBxyWSVVLfjPmSpPeRf0p7I2Ao
http://guides.rubyonrails.org/migrations.html
| # | |
| # Install the MYSQL driver | |
| # gem install mysql2 | |
| # | |
| # Ensure the MySQL gem is defined in your Gemfile | |
| # gem 'mysql2' | |
| # | |
| # And be sure to use new-style password hashing: | |
| # http://dev.mysql.com/doc/refman/5.0/en/old-client.html | |
| development: |