Skip to content

Instantly share code, notes, and snippets.

View josiah14's full-sized avatar

Josiah josiah14

  • 47 Degrees
  • Remote
View GitHub Profile
@josiah14
josiah14 / garrett-christmas-list-2022.md
Last active November 27, 2022 23:48
Garrett Christmas List 2022
@josiah14
josiah14 / prayers-before-work.md
Last active January 13, 2020 18:53
Prayers Before Commencing Work

Troparia and Kontakia to be used during the work day

To those who stumble upon this gist, herein are contained some short prayers to the following Orthodox Christian saints:

  • Elder Porphyrios (for he was a light unto scientists, mathematicians, and engineers in the 1990's, having been givin Divine insight into the intricate workings of nature beyond the scientific knowledge of that time)
  • Saint Patrick (for he built Churches, drove out "snakes" (how many of those do we encounter in our code??), and was exiled and forced to work as a slave. He is considered officially to be a Patron of Engineers by the Church).
  • St. Hubert (for his skill with metalwork and smithing, he is also considered a patron of mathematicians and engineers)
  • St. Eligius (patron of goldsmiths, metalworkers, and of the Royal Electrical and Mechanical Engineers of the British Army)

With the exception of St. Porphyrios, all other Saints are common to the Catholic Church, as well, if there are any Catholics with interest.

@josiah14
josiah14 / id3.pl
Created October 23, 2019 17:17
Iterative Dichotemizer example in Prolog
id3 :- ['id3.pl'].
:- ['id3.data'].
:- ['oklog.pl'].
test1(Tree) :-
data1(D), attrlist(L), id3(L, D, Tree).
test2(Tree) :-
data2(D), attrlist(L), id3(L, D, Tree).
@josiah14
josiah14 / functional_dependency_injection.py
Created December 20, 2018 22:54
Functional Dependency Injection In Python (Inspired by the Reader Monad)
class Reader(object):
pass
def to_camel_case(snake_str):
parts = snake_str.split('_')
return parts[0] + ''.join([s.capitalize() for s in parts[1:]])
def strip_leading_underscores(string):
if string.startswith('_'):
string = string[1:]
@josiah14
josiah14 / issues.md
Last active October 29, 2017 20:48
Problems encountered when compiling Hadoop ecosystem libraries.

HDFS

  • Need libprotoc 2.5.0 exactly, not compatible with newer systems (mine is running 2.6.1, which is causing a compile error).
    • FIX: Do the following steps
      wget https://github.com/google/protobuf/releases/download/v2.5.0/protobuf-2.5.0.tar.gz
      tar -xzf protobuf-2.5.0.tar.gz
      cd protobuf-2.5.0
      ./configure
      

make

@josiah14
josiah14 / defer.go
Created September 9, 2015 19:39
interesting defer behavour
package main
import "fmt"
func main() {
defer fmt.Println("world")
defer fmt.Println("dude")
defer println("sweet")
fmt.Println("hello")
@josiah14
josiah14 / osx-install-and-proxy.md
Last active June 13, 2016 10:01
OSX Installation and Proxy configuration

The setup for getting docker working on OSX behind a proxy is slightly more complex than just following the instructions on the Docker website. I found the information I needed at the below 2 links, but I'm copying the information here in case for some reason those links break or go away.

For Docker 1.4.1

Missing from the official install guide at the time of writing

First, install Docker normally according to the website: https://docs.docker.com/installation/mac/

Open up your ~/.bashrc or ~/.zshrc (depending on which shell you're using) and add the Docker environment variables by adding the following lines to the file:

@josiah14
josiah14 / reverse_string.hs
Created April 30, 2015 19:55
reverse string haskell
-- s is the original string. I recursively call reverse_s on the end of that string until there is nothing left in the string, in
-- which case, I just return the string (providing my edge case that ends the recursion so that I don't end up with infinite recusion).
-- I then prepend each result to the first character of each intermidate string in the recursion until my string has been fully
-- reversed.
reverse_s s = case s of "" -> s
c:cs -> reverse_s cs ++ [c]
-- or you could make it even shorter...
-- foldl is the same as reduce, the part in the parenthesis is a lambda function that takes 2 parameters, an accumulation of the
-- computet result so far, and the current character of the string the calculation is working on.