Skip to content

Instantly share code, notes, and snippets.

View rodoherty1's full-sized avatar

Rob O'Doherty rodoherty1

  • Ireland
View GitHub Profile
ns () {
NEW_SCRATCH_DIR=~/workspace/scratch/src/main/resources/$(date +%b%d)
mkcdir $NEW_SCRATCH_DIR
touch $NEW_SCRATCH_DIR/scratch.txt
}
@rodoherty1
rodoherty1 / K8sNotes.md
Last active December 17, 2018 11:08
Kubernetes CLI Commands

GCP GKE Notes

gcloud auth list
gcloud config set account [ACCOUNT]
gcloud auth login

gcloud auth configure-docker

gcloud config list
gcloud container clusters get-credentials [CLUSTER_NAME] --zone us-central1-a --project [PROJECT]
@rodoherty1
rodoherty1 / README.md
Last active June 26, 2018 08:55
jq Examples
> cat test3.json
{
  "markets": [
  {
    "a": "value1",
    "b": "value2"
  },
  {
 "a": "value3"
@rodoherty1
rodoherty1 / xargs.sh
Created May 2, 2017 08:44
Simple bash loop and xargs example
#!/bin/sh
find . -name "whatever*" | xargs -0 -I {} ls -l {}
for i in `seq 1 10`; do mv "SomeDoc$i" "SomeName$i.txt"; done
The text below is lifted from https://fredreh.wordpress.com/2011/12/07/how-to-add-a-ppa-key-if-you-are-behind-a-restrictive-firewall-port-11371-is-blocked/
*Summary*
Go to http://keyserver.ubuntu.com/pks/lookup?search=0x0AB215679C571D1C8325275B9BDB3D89CE49EC21&op=index
Replace the key in the url with the key you need.
Copy the search results to a text file
@rodoherty1
rodoherty1 / gist:5c6620309727e6dd27ac5edb96d53261
Created February 23, 2017 09:46
Basic Enumerations in Scala.
object Enum1 extends Enumeration {
val e1, e2 = Value
}
object Enum2 extends Enumeration {
val e3, e4 = Value
}
def f (a: Enum1.Value, b: Enum2.Value) = println(s"$a, $b")
@rodoherty1
rodoherty1 / gist:00932af244e628c4f08ecf76cd8acae5
Created February 22, 2017 14:22
Quick example of ordering using scala.collection.SortedSet
scala> :paste
// Entering paste mode (ctrl-D to finish)
trait RobC extends Product with Serializable
case class Rob1(s: String) extends RobC
case class Rob2(s: String) extends RobC
object RobC {
implicit def ordering[A <: RobC] = new Ordering[A] {
override def compare(x: A, y: A): Int = {
@rodoherty1
rodoherty1 / wait.scala
Created January 9, 2017 08:59
Wait until user hits return
println(s"Server online at http://localhost:8080/\nPress RETURN to stop...")
StdIn.readLine() // let it run until user presses return
scala> Process(1, 2, 3).zip(Process(3, 4, 5))
res36: scalaz.stream.Process[Nothing,(Int, Int)] = Append(Halt(End),Vector(<function1>))
scala> res36.toSource.runLog.run
res38: Vector[(Int, Int)] = Vector((1,3), (2,4), (3,5))
scala> Process(1, 2, 3).interleave(Process(3, 4, 5))
res39: scalaz.stream.Process[Nothing,Int] = Append(Halt(End),Vector(<function1>))
@rodoherty1
rodoherty1 / scalaz-examples.scala
Created July 28, 2016 11:21
Scalaz Process examples
/**
* Sink[Task, Double] === Process[Task, A => Task[Unit]]
*/
import scalaz.stream._
import scalaz.concurrent.Task
import scala.math._
val puts: Double => Task[Unit] = d: Double => println(d)