View passphrase.js
// npm install pbkdf2
const pb = require("pbkdf2");
const ssid = "ssid";
const password = "plain-text-password";
printHash = (err, res) => console.log(res.toString("hex"));
pb.pbkdf2(password, ssid, 4096, 32, "sha1", printHash);
View raspbian.md

Raspbian Strech Lite Quick setup

In order to enable SSH and wifi on first boot we need to add two files to the root folder on the SD card before inserting it into the raspberry.

First, create an empty file named ssh. Then, create a second file called wpa_supplicant.conf. The contents of this file should be

country=US
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
View a-seeds.exs
# In this example, Video has_many authors.
# Here is the code for creating a video with authors
# using a single call to Repo.insert
Enum.map([
%{"title" => "Elixir", "duration" => 123, "authors" => [
%{"name" => "José Valim"}
]
},
%{"title" => "JavaScript", "duration" => 666, "authors" => [
%{"name" => "Brendan Eich"}
View install-ruby-1.8.7.sh
#!/bin/sh
# The main issues with Ruby 1.8.7 are that it won't build with Clang,
# and the Net::HTTPS module won't work with modern versions of OpenSSL.
#
# This assumes you have already set up homebrew, and run: xcode-select --install
#brew install homebrew/dupes/apple-gcc42
#brew install libyaml libffi
brew install https://github.com/Homebrew/homebrew-versions/raw/586b7e9012a3ed1f9df6c43d0483c65549349289/openssl098.rb
export CC=/usr/local/bin/gcc-4.2
View cart.exs
# from ounce of elixir
#https://www.meetup.com/Women-Who-Code-Tampa/events/233014583/
ExUnit.start
defmodule CartTest do
use ExUnit.Case
test "starts with empty count" do
assert Cart.count_items([]) == 0
View datetime.exs
defmodule CreditCard do
def current_amount_due(charges, apr, due_date, current_date \\ date_now()) do
current_date
# then proceed with calculation..
end
defp date_now do
DateTime.utc_now |> DateTime.to_unix
end
View a-main.go
package main
import (
"demo/lib"
"sync"
)
func main() {
connections := lib.GetAllConnections()
var wg sync.WaitGroup
View main.go
package main
import (
"fmt"
"sync"
"time"
"math"
)
func main() {
View a-main.go
// Manual Semaphore
package main
import (
"fmt"
"time"
)
func main() {
startTime := time.Now().Unix()
View go.go
// first stab
const defaultPort = "8080"
func getPort() string {
portEnv := os.Getenv("PORT")
if portEnv != "" {
return portEnv
}
return defaultPort
}