This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Date, blocknum, difficulty as of 2019-01-18 | |
# Script by vbuterin, slightly modified by lrettig | |
import random | |
import datetime | |
import sys | |
def calc_bomb(i): | |
period = i // 100000 | |
if (period > 0): | |
# Subtract 2, this is the original formula |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PumaHelper | |
def self.refresh_connection_pool(base_klass, config_key) | |
base_klass = base_klass.constantize | |
config = Rails.application.config.database_configuration[config_key] | |
base_klass.connection_pool.disconnect! rescue ActiveRecord::ConnectionNotEstablished | |
base_klass.connection.disconnect! rescue ActiveRecord::ConnectionNotEstablished | |
base_klass.establish_connection config | |
true | |
rescue |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Function to print strftime results | |
def print_strftime_formats(a,cur_date) | |
a.each do |format| | |
b = "%#{format}" | |
output = cur_date.strftime(b) | |
puts "t.strftime('#{b}'), => #{output}" | |
end | |
end | |
a = ('a'..'z').to_a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# List all keys stored in memcache. | |
# Credit to Graham King at http://www.darkcoding.net/software/memcached-list-all-keys/ for the original article on how to get the data from memcache in the first place. | |
require 'net/telnet' | |
headings = %w(id expires bytes cache_key) | |
rows = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>DVTConsoleDebuggerInputTextColor</key> | |
<string>0.811765 0.796078 0.564706 1</string> | |
<key>DVTConsoleDebuggerInputTextFont</key> | |
<string>Inconsolata - 16.0</string> | |
<key>DVTConsoleDebuggerOutputTextColor</key> | |
<string>1 1 1 1</string> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def merge_sort(arr) | |
return arr if arr.size <= 1 | |
left, right = halve_array(arr) | |
left_part = merge_sort(left) | |
right_part = merge_sort(right) | |
array = [] | |
offset_left_part = 0 | |
offset_right_part = 0 |