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
start = Time.now | |
loop { | |
elapsed = Time.now - start | |
puts "#{(elapsed/60).round}m:#{(elapsed%60).round}s" | |
sleep 1 | |
} |
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
http{ | |
index index.html; | |
server { | |
listen 80; | |
root /gocode/src/personalwebsiteapp; | |
server_name personal-website.com; |
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
# Thee will be more information here when I share the entire problem space I'm working on, but | |
# in short, this is preview material for my second talk in a series called "What Computer Scientists Know". | |
# The first talk is on recursion, and goes through several examples., leading up to a problem based | |
# on a simple puzzle that initial estimates based on performance of a previous puzzle would take years | |
# to solve on modern computers with the techniques shown in Ruby. That sets the stage for improving the | |
# performance of that problem with threading, concurrency, and related tuning. | |
# | |
# The second talk is on threading and concurrency, touching on algorithmic performance as well. | |
# Using some knowledge of the problem (board symmetry, illegal moves, etc), we reduce the problem space | |
# to about .5% of what we initially thought it was. Still, the initial single threaded solution took more |
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
-- http://stackoverflow.com/questions/1124603/grouped-limit-in-postgresql-show-the-first-n-rows-for-each-group | |
-- http://www.postgresql.jp/document/9.2/html/tutorial-window.html | |
CREATE TABLE empsalary ( | |
depname varchar(10) not null | |
, empno integer not null | |
, salary integer not null | |
); | |
INSERT INTO empsalary (depname, empno, salary) VALUES ('develop', 11, 5200); |
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
DON'T JUST COPY AND PASTE | |
YOUR USB DRIVE MAY NOT BE /dev/sdd AND THIS WILL ERASE IT | |
$ df -h | |
Filesystem Size Used Avail Use% Mounted on | |
/dev/sda7 7.4G 3.9G 3.2G 56% / | |
none 3.9G 720K 3.9G 1% /dev | |
none 3.9G 704K 3.9G 1% /dev/shm | |
none 3.9G 96K 3.9G 1% /var/run | |
none 3.9G 0 3.9G 0% /var/lock |
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
var http = require('http'), // intentionally using http to connect to https | |
options = { | |
host: 'localhost', | |
port: 4443, | |
path: '/ping', | |
}; | |
function pingLoop() { | |
http.get(options, function (res) { | |
console.assert(false, "server should never accept http over https"); |
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
// A cute hack demonstrating one (weird?) way of doing optional | |
// parameters in Go. | |
// | |
// Please don't write code like this. It is fun code, though. | |
// | |
// Output: (see it live at golang.org) | |
// | |
// I like cheese. | |
// Do you like cheese too? | |
// I DO! |
NewerOlder