Skip to content

Instantly share code, notes, and snippets.

Spencer Williams spencerwi

Block or report user

Report or block spencerwi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@spencerwi
spencerwi / up.sh
Created Sep 10, 2019
Bash function to go up 1 or more directories without manually cd-ing
View up.sh
function up {
if [ -z "$1" -o ! "$1" -gt 0 ]; then
cd ..
else
CDSTR=""
for i in $(seq 1 $1) ; do
CDSTR="../$CDSTR"
done
cd $CDSTR
fi
View keybase.md

Keybase proof

I hereby claim: * I am spencerwi on github. * I am spencerwi (https://keybase.io/spencerwi) on keybase. * I have a public key ASDH0-05zgpKQvvw9CMrPNc8VSvwzUjFSjGZgUy2Iw9Nlgo To claim this, I am signing this object:

{   "body": {     "key": {       "eldest_kid": "0120c7d3ed39ce0a4a42fbf0f4232b3cd73c552bf0cd48c54a3199814cb6230f4d960a",       "host": "keybase.io",       "kid": "0120c7d3ed39ce0a4a42fbf0f4232b3cd73c552bf0cd48c54a3199814cb6230f4d960a",       "uid": "2891c166bc8338e49bc795c0c4e36b19",       "username": "spencerwi"     },     "merkle_root": {       "ctime": 1561980248,       "hash": "dbcdfcb5dd7c54574d8754f0bb5d5f0557b49c1e568358f5ebbed8e2195a0b380286b05e5e4c73d8517a26107a5933c3fd2336bcaf814c9b4bce60d1da9bab8b",       "hash_meta": "e216177a1f552fb4e5fcbcfc41cc78567de60953b26a6cddbe73d5e205fa2acc",       "seqno": 5671655     },     "service": {       "entropy": "bQvCp9/Vxl/o2tBjuphc+LNC",       "name": "github",       "username": "spencerwi"     },     "type": "web_
View .editorconfig
# This is the "system-level" editorconfig
root = true
# Unix-style newlines with a newline ending every file
[*]
end_of_line = lf
insert_final_newline = true
# 4-space indent for JSON
[*.json]
@spencerwi
spencerwi / ips.fsx
Created Jan 9, 2017
Get IP addresses on local machine (using only F# stdlib)
View ips.fsx
open System
open System.Net
open System.Linq
let applyFilters showIPv4Only showIPv6Only addrs =
match (showIPv4Only, showIPv6Only) with
| (true, false) -> Seq.filter (fun (addr: IPAddress) -> addr.AddressFamily = Sockets.AddressFamily.InterNetwork) addrs
| (false, true) -> Seq.filter (fun (addr: IPAddress) -> addr.AddressFamily = Sockets.AddressFamily.InterNetworkV6) addrs
| (_, _) -> addrs
View whenwas.fsx
#!/usr/bin/env fsharpi --exec
open System
type DateScale = Hour | Hours | Day | Days | Week | Weeks
type DateDirection = Ago | Forward
let parseDirection strInput =
match strInput with
| "forward" | "from now" -> Forward
View ping-until-up.sh
#!/bin/bash
###
# Pings a host until the host responds.
###
if [ "$#" -gt 0 ] ; then
IS_LIVE=false;
while ! $IS_LIVE ; do
@spencerwi
spencerwi / CodeWarsTestRunner.scala
Last active Sep 17, 2016
Codewars test harness for scala (using scalatest)
View CodeWarsTestRunner.scala
import org.scalatest._;
import org.scalatest.events._;
class CodeWarsReporter extends Reporter {
def apply(event: Event) : Unit = event match {
case e: SuiteStarting => println(s"<DESCRIBE::> ${e.suiteName}")
case e: ScopeOpened => println(s"<DESCRIBE::> ${e.message}")
case e: TestStarting => println(s"<IT::>${e.testName}")
case e: TestSucceeded => {
println(s"<PASSED::>${e.testName}")
View js-joda.d.ts
declare abstract class TemporalAccessor {
get(field: TemporalField): number
query(query: TemporalQuery): any
range(field: TemporalField): ValueRange
}
declare abstract class Temporal extends TemporalAccessor {}
declare abstract class Clock {
static fixed(fixedInstant: Instant, zoneOffset: ZoneOffset): Clock
static system(zone: ZoneId): Clock
@spencerwi
spencerwi / Response.md
Last active Jul 29, 2016
In response to Wayne Grudem, regarding his endorsement of voting for Donald Trump as "morally good"
View Response.md

I also have found Grudem to be respectable in his Systematic Theology, but I'm disappointed in this article.

In summary, Grudem's points are:

  • Trump's not really that bad, is he? His sins, even though he wears them proudly, shouldn't be offensive to Christians.
  • Trump is the lesser of two evils. You don't want Hillary to win, do you? (Put another, even-more-cliched way, "not voting is the same as voting for Hillary" -- which is false, if I was never going to vote for Trump in the first place).
  • Christianity means doing what's best for America (and Trump is what's best for America).

I disagree with these premises; I do think the sins that Trump wears not just unrepentantly, but proudly, should be offensive to Christians, and should be more offensive to Grudem than they are; he minimizes outright insults that Trump has doubled-down on as "careless remarks" rather than the more Biblical "out of overflow of the heart, the mouth speaks" (as Jesus said in Luke 6).

Yes, Trump is egotistical. That fault can

@spencerwi
spencerwi / Mappable.java
Created May 6, 2016
HigherKindedTypes blog post code
View Mappable.java
public interface Mappable<A> {
public <B> Mappable<B> map(Function<A, B> f);
}
You can’t perform that action at this time.