Skip to content

Instantly share code, notes, and snippets.

View leifericf's full-sized avatar

Leif Eric Fredheim leifericf

View GitHub Profile
@leifericf
leifericf / install-java-macos.md
Last active January 11, 2024 21:38
Installing Java on macOS and Adding It to jEnv

Install Homebrew:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Install jEnv using Homebrew:

brew install jenv

Add the cask-versions tap to Homebrew:

@leifericf
leifericf / bb.edn
Last active January 9, 2024 20:21
Consuming 3rd Party APIs Using Clojure (Babashka)
{:paths ["src"]
:deps {org.babashka/json {:mvn/version "0.1.1"}}}
@leifericf
leifericf / git-hash.rb
Last active August 29, 2015 14:03
Generate Git file (aka "blob") hash, without using Git.
#!/usr/bin/env ruby
require 'digest/sha1'
def git_hash(file)
data = File.read(file)
size = data.bytesize.to_s
Digest::SHA1.hexdigest('blob ' + size + "\0" + data) # Git's hashing algorithm
end
@leifericf
leifericf / binet.rb
Last active August 29, 2015 14:02
Binet's Formula and Fibonacci Numbers
#!/usr/bin/env ruby
=begin
Ref. Python implementation from this answer on StackOverflow:
http://stackoverflow.com/a/7843192/195964
=end
include Math
=begin