Skip to content

Instantly share code, notes, and snippets.

View jfredett's full-sized avatar

Joe Fredette jfredett

View GitHub Profile
@jfredett
jfredett / error output
Last active February 26, 2023 18:51
NixOS Parameterized Module Issue
unpacking channels...
error: infinite recursion encountered
at /nix/var/nix/profiles/per-user/root/channels/nixos/lib/modules.nix:256:21:
255| (regularModules ++ [ internalModule ])
256| ({ inherit lib options config specialArgs; } // specialArgs);
| ^
257| in mergeModules prefix (reverseList collected);
(use '--show-trace' to show detailed location information)
Assume the mic feeds something like a .wav at some sample rate.
So every cycle we get an array of voltages the mic saw at whatever
sample rate. Then calculate:
```
sample = <array of voltages>
max_v = maximum_of(sample)
min_v = minimum_of(sample)
pulse_coef = 0
### Keybase proof
I hereby claim:
* I am jfredett on github.
* I am jfredett (https://keybase.io/jfredett) on keybase.
* I have a public key whose fingerprint is 7B88 7F7F 9CA9 6FE0 C660 E843 3559 8F00 9272 4DA7
To claim this, I am signing this object:
@jfredett
jfredett / horse-shit.mkd
Created April 5, 2016 19:24
How I roughly feel at the moment.

A thought experiment.

The Schwarzchild radius is the distance to which an object of a given mass must be compressed before it’s surface gravity would disallow the escape of light. That is, it is the size to which an object of some mass M must be compressed before becoming a black hole. It is given a definition as follows:

r < M * 2G/c^2

Where r is the Schwarzchild radius, M is the mass of the object, G the gravitational constant of the universe, and c the speed of light. We can some up with the minimum r by simply asserting this inequality as an equality and solving.

@jfredett
jfredett / box.rb
Created December 18, 2015 18:04
box.rb
#!/usr/bin/env ruby
lines = ARGF.each_line.to_a.map(&:chomp)
line_max = lines.map(&:length).max
lines = lines.map do |line|
offset = (line_max + line.length) / 2
line = line.rjust(offset).ljust(line_max)
'* ' + line + ' *'
end
line_max = lines.map(&:length).max

Keybase proof

I hereby claim:

  • I am jfredett on github.
  • I am jfredett (https://keybase.io/jfredett) on keybase.
  • I have a public key whose fingerprint is B3B3 9E81 1B33 9B29 BE12 BC92 BA39 A2A9 C7EA 4DC7

To claim this, I am signing this object:

[2013-10-01 18:09:14] Configuring Rubinius...
[2013-10-01 18:09:14] Command line: ""
[2013-10-01 18:09:14] Checking gcc:
[2013-10-01 18:09:14] found
[2013-10-01 18:09:14] Checking g++:
[2013-10-01 18:09:14] found
[2013-10-01 18:09:14] Checking bison:
[2013-10-01 18:09:14] found
[2013-10-01 18:09:14] Configuring LLVM...
[2013-10-01 18:09:14] Checking for existing LLVM library tree:
@jfredett
jfredett / 1.9.3
Created September 19, 2013 13:11
Rubocop AlignHash crash.
An error occurred while AlignHash cop was inspecting /Users/jfredett/code/mine/dugout/lib/dugout/math/parser/model.rb.
For /Users/jfredett/code/mine/dugout/doc: configuration from /Users/jfredett/code/mine/dugout/.rubocop.yml
Default configuration from /Users/jfredett/.rvm/gems/ruby-1.9.3-p448@dugout/gems/rubocop-0.13.0/config/default.yml
Inheriting configuration from /Users/jfredett/.rvm/gems/ruby-1.9.3-p448@dugout/gems/rubocop-0.13.0/config/enabled.yml
Inheriting configuration from /Users/jfredett/.rvm/gems/ruby-1.9.3-p448@dugout/gems/rubocop-0.13.0/config/disabled.yml
Inspecting 32 files
Scanning /Users/jfredett/code/mine/dugout/lib/dugout/math/model/ast/addition.rb
.Scanning /Users/jfredett/code/mine/dugout/lib/dugout/math/model/ast/exponential.rb
.Scanning /Users/jfredett/code/mine/dugout/lib/dugout/math/model/ast/literal.rb
.Scanning /Users/jfredett/code/mine/dugout/lib/dugout/math/model/ast/log.rb
require 'spec_helper'
describe QuitCommand do
let(:terminal) { double('terminal', shutdown: true ) }
let(:command) { QuitCommand.new terminal }
context do
subject{ command }
#command_factory_spec.rb:
require 'spec_helper'
describe CommandFactory do
let(:factory) { CommandFactory.new nil }
subject { factory.command(:foo) }
context 'a thing' do