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
#!/bin/sh | |
curlget() { | |
url=http://ftp5.usa.openbsd.org/pub/OpenBSD/$1/i386 | |
echo $2 | |
curl -O -# $url/$2 | |
} | |
download() { | |
# 5.6 -> 56 |
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 insert_sql_for(table_name, data) | |
stmt = Arel::Nodes::InsertStatement.new | |
stmt.relation = Arel::Table.new(table_name) | |
stmt.columns = data.keys.map { |k| Arel::Table.new(table_name)[k] } | |
stmt.values = Arel::Nodes::Values.new(data.values, stmt.columns) | |
stmt.to_sql | |
end | |
require "active_record" | |
ActiveRecord::Base.establish_connection("postgres:///db") |
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
(defun copy-clipboard() | |
"Save last item in kill ring to clipboard" | |
(interactive) | |
(let ((tmp-file (make-temp-file "pbcopy"))) | |
(with-temp-buffer | |
(yank) | |
(when (file-writable-p tmp-file) | |
(write-region (point-min) | |
(point-max) | |
tmp-file) |
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 factorial_zeros_count(x): | |
res = 0 | |
div = 5 | |
while(x >= div): | |
res += x / div | |
div *= 5 | |
return res | |
n = int(input()) | |
for i in range(n): |