This is a collection of basic "recipes", many using twurl (the Swiss Army Knife for the Twitter API!) and jq to query the Twitter API and format the results. Also, some scripts to test or automate common actions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"metadata" : { | |
"name" : "GraphFramesExample", | |
"user_save_timestamp" : "1970-01-01T01:00:00.000Z", | |
"auto_save_timestamp" : "1970-01-01T01:00:00.000Z", | |
"language_info" : { | |
"name" : "scala", | |
"file_extension" : "scala", | |
"codemirror_mode" : "text/x-scala" | |
}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.xdotai | |
import shapeless._ | |
import shapeless.ops.hlist.{Prepend, Align, Remove} | |
object TypedPipelineComposition { | |
import ShapelessExt._ | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// a List isn't a Map | |
scala> val x: Map[Int,Int] = List(1,2,3).map(i => i -> i) | |
<console>:16: error: type mismatch; | |
found : List[(Int, Int)] | |
required: Map[Int,Int] | |
val x: Map[Int,Int] = List(1,2,3).map(i => i -> i) | |
^ | |
// first create List, then create Map. Intermediate collection overhead | |
scala> val x: Map[Int,Int] = List(1,2,3).map(i => i -> i).toMap | |
x: Map[Int,Int] = Map(1 -> 1, 2 -> 2, 3 -> 3) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -ex | |
if [ "$(cat /mnt/var/lib/info/instance.json | jq -r .isMaster)" == "true" ]; then | |
# Install Git | |
sudo yum -y install git | |
# Install Maven | |
wget -P /tmp http://apache.mirrors.spacedump.net/maven/maven-3/3.3.3/binaries/apache-maven-3.3.3-bin.tar.gz | |
sudo mkdir /opt/apache-maven | |
sudo tar -xvzf /tmp/apache-maven-3.3.3-bin.tar.gz -C /opt/apache-maven |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# This playbook assumes the WebSphere MQ file provided by IBM has already been | |
# downloaded to a specific directory (target.wd) on the server. | |
# | |
# ${target.wd} is a variable representing the working directory on the target | |
# server the MQ client will be installed. | |
# | |
# Note: Although this playbook is designed to be able to be run independently, | |
# it is in fact part of a longer playbook and therefore may have some other | |
# unexpected dependencies not reflected here. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package inception.commands; | |
import static org.junit.Assert.assertArrayEquals; | |
import static org.junit.Assert.assertEquals; | |
import javax.ws.rs.client.Entity; | |
import org.mockito.ArgumentMatcher; | |
public class UnfuckEntity extends ArgumentMatcher<Entity<?>> { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::fmt; | |
use std::ascii::StrAsciiExt; | |
#[deriving(Clone,Eq)] | |
pub enum HeaderName { | |
Accept, | |
AcceptCharset, | |
AcceptEncoding, | |
AcceptLanguage, | |
Age, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.concurrent.duration._ | |
import scala.concurrent.ExecutionContext | |
import scala.concurrent.Future | |
import akka.pattern.after | |
import akka.actor.Scheduler | |
/** | |
* Given an operation that produces a T, returns a Future containing the result of T, unless an exception is thrown, | |
* in which case the operation will be retried after _delay_ time, if there are more possible retries, which is configured through | |
* the _retries_ parameter. If the operation does not succeed and there is no retries left, the resulting Future will contain the last failure. |
This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.
The script is here:
#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"