Skip to content

Instantly share code, notes, and snippets.

View timperrett's full-sized avatar
🚧

Timothy Perrett timperrett

🚧
View GitHub Profile

Configuring SBT to use 1Password

  1. Install swig-python
  2. Use pip to install 1pass
  3. Install py-levenshtein to avoid annoying warnings
  4. Locate the nearest 1pass script (note: it may be behind you)
  5. Test 1pass on a random password

Create ~/.sbt/0.13/plugins/build.sbt with the following contents:

@pchiusano
pchiusano / diamonds.scala
Last active August 29, 2015 14:07
Creating diamonds in the scalaz-stream dataflow graph
object tee {
/**
* Convert a `Tee` to a `Process1` by feeding the same input to both sides of the `Tee`.
* Named after the 'diamond' shape this creates in the dataflow graph.
*/
def diamond[A,B](t: Tee[A,A,B]): Process1[A,B] = Process.suspend {
// todo: there's a more complex impl that performs better when branches
// have vastly different rates of processing
val (hd, tl) = t.unemit
@sr75
sr75 / wget-jdk-oracle-install-example.txt
Last active March 16, 2023 11:28
wget command to install Oracle JAVA JDK from stupid oracle website for centos and ubuntu
http://d.stavrovski.net/blog/post/how-to-install-and-setup-oracle-java-jdk-in-centos-6
# rpm
wget --no-cookies \
--no-check-certificate \
--header "Cookie: oraclelicense=accept-securebackup-cookie" \
"http://download.oracle.com/otn-pub/java/jdk/7u55-b13/jdk-7u55-linux-x64.rpm" \
-O jdk-7-linux-x64.rpm
# ubuntu
@phillipuniverse
phillipuniverse / ntp.conf
Last active November 8, 2022 14:40
Set up NTP with Ansible, dedicating one as a timelord
# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help
driftfile /var/lib/ntp/ntp.drift
# Enable this if you want statistics to be logged.
#statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
@viktorklang
viktorklang / InterruptibleCancellableFuture.scala
Last active June 1, 2020 13:45
Interruptible-Cancellable-scala.concurrent.Future
/*
Copyright 2018 Viktor Klang
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@dcbriccetti
dcbriccetti / gist:3804602
Created September 29, 2012 17:07
How would you avoid the Option.get?
case class Dog(name: String, tailLength: Option[Int])
val dogs = Seq(Dog("Sparky", Some(85)), Dog("Rotty", None))
val (dogsWithTails, dogsWithoutTails) = dogs.partition(_.tailLength.isDefined)
if (! dogsWithoutTails.isEmpty)
println("These dogs are missing tails: " +
dogsWithoutTails.map(_.name).mkString(", "))
dogsWithTails.map(dog => {
@marktheunissen
marktheunissen / pedantically_commented_playbook.yml
Last active September 24, 2024 14:52 — forked from phred/pedantically_commented_playbook.yml
Insanely complete Ansible playbook, showing off all the options
This playbook has been removed as it is now very outdated.
@hellerbarde
hellerbarde / latency.markdown
Created May 31, 2012 13:16 — forked from jboner/latency.txt
Latency numbers every programmer should know

Latency numbers every programmer should know

L1 cache reference ......................... 0.5 ns
Branch mispredict ............................ 5 ns
L2 cache reference ........................... 7 ns
Mutex lock/unlock ........................... 25 ns
Main memory reference ...................... 100 ns             
Compress 1K bytes with Zippy ............. 3,000 ns  =   3 µs
Send 2K bytes over 1 Gbps network ....... 20,000 ns  =  20 µs
SSD random read ........................ 150,000 ns  = 150 µs

Read 1 MB sequentially from memory ..... 250,000 ns = 250 µs

import scalaz._, Scalaz._, effect._
type Env = Map[String,String]
type Error = String
case class AppStack[A](f: Env => IO[Validation[Error,A]])
object AppStack {
implicit val appStackMonad = new Monad[AppStack] {
def point[A](a: => A): AppStack[A] =
@dragos
dragos / scalac.sublime-build
Created January 27, 2012 14:53
Use F4 to jump to error in SublimeText2
{
"cmd": ["/opt/scala/bin/scalac", "$file"],
"file_regex": "^(\\S...*?):([0-9]*):?([0-9]*)",
"selector": "source.scala"
}