Skip to content

Instantly share code, notes, and snippets.

@zzak
zzak / await.sh
Created March 1, 2023 22:33
Script to wait for localhost service in bash, with retries
#!/usr/bin/env bash
set -euo pipefail
TRIES=0
until [ $TRIES -eq 10 ] || nc -z localhost 3000; do
sleep 0.1
TRIES=$(( TRIES+1 ))
done
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/zscott/.rubies/ruby-trunk/bin/ruby extconf.rb
checking for sqlite3.h... yes
checking for sqlite3_libversion_number() in -lsqlite3... yes
checking for rb_proc_arity()... yes
checking for sqlite3_initialize()... yes
checking for sqlite3_backup_init()... yes
checking for sqlite3_column_database_name()... no
checking for sqlite3_enable_load_extension()... no
// ==UserScript==
// @name Agile Poker Fullscreen
// @namespace http://tampermonkey.net/
// @version 0.2
// @updateURL https://gist.github.com/zzak/2dc3c582db686c02b4ec1fd313bb6e42/raw/agile-poker-fullscreen.user.js
// @description Make the Agile Poker modal dialog fullscreen (desktop friendly)
// @author Zachary Scott <zzak>
// @match https://agile-poker-production.herokuapp.com/*
// @require https://cdnjs.cloudflare.com/ajax/libs/arrive/2.4.1/arrive.min.js
// @grant GM_addStyle
$ ruby -Itest test/generators/scaffold_generator_test.rb
Run options: --seed 61346
# Running:
.F............
Finished in 1.572028s, 8.9057 runs/s, 152.6690 assertions/s.
1) Failure:
@zzak
zzak / squareroot.rb
Created June 30, 2010 16:34
find the square root in ruby
def sqrt(x)
square = lambda { |a| a * a }
average = lambda { |a,b| (a + b)/2.0 }
is_good_enough = lambda { |a| (square[a] - x).abs < 0.001 }
improve = lambda { |a| average[a, x/a] }
sqrt_iter = lambda { |a| is_good_enough[a] ? a : sqrt_iter[improve[a]] }
sqrt_iter[1.0]
end
@zzak
zzak / config.yml
Last active August 24, 2018 23:59 — forked from pamo/config.yml
CircleCI 2.0 Workflows
references:
defaults: &defaults
working_directory: ~/app
docker:
- image: circleci/node:8.1.4-browsers
npm_permissions: &npm_permissions
run:
name: set-user-permissions
@zzak
zzak / gist:70478cd7c3b7124ecc97ed19a336dfd5
Created April 25, 2017 15:21
Most commits to Ruby since 2012
~/code/ruby => git shortlog -s -n --all --since=2012
7701 nobu
2156 svn
1686 naruse
1629 usa
1550 nagachika
1393 akr
1219 ko1
703 hsbt
624 kazu
wget https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc
sudo apt-key add erlang_solutions.asc
sudo apt-add-repository "https://packages.erlang-solutions.com/ubuntu yaketty contrib"
sudo apt-get update
sudo apt-get install erlang
## Shibuya.lisp#50
twitter: @shibuya_lisp
hashtag: #lispmeetup
event: https://lisp.connpass.com/event/52912/
survey: https://twitter.com/shibuya_lisp/status/834710395868766208
cl-cudd
decision diagram
Warming up --------------------------------------
Forwardable 148.719k i/100ms
Send 334.975k i/100ms
Simple call 380.722k i/100ms
Calculating -------------------------------------
Forwardable 1.999M (± 5.0%) i/s - 10.113M in 5.073999s
Send 7.768M (± 5.4%) i/s - 38.857M in 5.018102s
Simple call 10.120M (± 6.8%) i/s - 50.636M in 5.027285s