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
module github.com/benweint/sqlite-demo | |
go 1.20 | |
require github.com/mattn/go-sqlite3 v1.14.18 // indirect |
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
{ | |
"name": "pnpm-signals", | |
"private": true, | |
"version": "1.0.0", | |
"description": "", | |
"scripts": { | |
"dev": "node signals.js" | |
}, | |
"author": "", | |
"license": "ISC" |
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 python | |
import simpy | |
import random | |
import math | |
import pandas | |
import matplotlib | |
import matplotlib.pyplot as plt | |
# Represents a shared database instance with a fixed CPU allocation. |
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
# Here's the script I'll use to demonstrate - it just loops forever: | |
$ cat test.rb | |
#!/usr/bin/env ruby | |
loop do | |
sleep 1 | |
end | |
# Now, I'll start the script in the background, and redirect stdout and stderr |
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
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDCu9eMRYwWS5Z1bLjpfPfKzuvQhKOhGX0Q7KLPOf3rkgsyZ8mJGGnKMAjpDFeH7MIjwQ1au9Gp3tc+ENbnyjHhtRDUkajTjU6odq2DYMUuGJo5JJTbUFPOrHcTn5kgDpc4a9XTT+7EHS9gC8SjGzsxqTMf1WafoaKrDH2WS3vdo91MMmsmDJorro0FjWcN1gkGlXkqqxdUuiQjY19NAEetCyoMOxnmjFI4qFF7U4L1ynHVUfGyE0XOUru1YgAOYvncNoSShkFqoln7fSPE6lLz1GBt6e5KDOhpVSRU/S5FLmFBGUg8ajG7UzokFE1QE2Oqg8KJTAF42gr5xRMIkH/D ben@Bens-MacBook-Pro.local |
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
require 'sidekiq/api' | |
if File.basename($0) == 'sidekiq' | |
Thread.new do | |
loop do | |
begin | |
t0 = Time.now | |
qcount = 0 | |
njobs = 0 |
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 | |
# | |
# When run against rails/rails commit 91684fb193a91671d682701cc1357e7b4b3fbe2b, | |
# this code produces the following output on my machine: | |
# | |
# long start @ 0.000 | |
# short start @ 0.510 | |
# short finish @ 1.511 | |
# short reported 1.511186 s |
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 | |
# Pass 'fork' as the first argument to use Process.fork, otherwise Process.daemon is used. | |
do_fork = (ARGV[0] == 'fork') | |
thread = Thread.new do | |
loop { sleep(1) } | |
end |
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 | |
class BadString < String; end | |
original = (0..255).to_a.pack("C*").force_encoding("UTF-8") | |
subclass = BadString.new(original) | |
round_tripped = subclass.to_s | |
puts "encoding: original = #{original.encoding}, subclass = #{subclass.encoding}, round_tripped = #{round_tripped.encoding}" | |
puts "valid_encoding? original = #{original.valid_encoding?}, subclass = #{subclass.valid_encoding?}, round_tripped = #{round_tripped.valid_encoding?}" |
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 | |
string = "\n\v" | |
puts "before racc require: #{Array(string).inspect}" | |
require 'racc' | |
puts "after racc require: #{Array(string).inspect}" |
NewerOlder