Skip to content

Instantly share code, notes, and snippets.

View crimeminister's full-sized avatar
💭
🔥 🐶🎩☕️🔥

Robert Medeiros crimeminister

💭
🔥 🐶🎩☕️🔥
View GitHub Profile
@crimeminister
crimeminister / tpl-rss.rb
Created August 20, 2016 20:13
Generate Atom feed of books checked out of Toronto Public Library (by Gabriel Mansour)
#!/usr/bin/env ruby
#
# == TPL-RSS ==
# <http://github.com/gabrielmansour/tpl-rss>
# Provides an RSS (Atom) Feed of books checked out from the Toronto Public Library
# created by Gabriel Mansour
# based on the Perl script by Sacha Chua <http://sachachua.com/wp/2009/03/29/new-library-reminder-script/>
#
require 'rubygems'
require 'mechanize'
@crimeminister
crimeminister / Dockerfile
Created July 6, 2016 04:37
Dockerfile to product openjdk7-jre container (legacy)
# openjdk7-jre
#
# VERSION 0.1.0
FROM ubuntu
MAINTAINER Robert Medeiros <[email protected]>
# Fake a fuse install
# Cf. https://gist.github.com/henrik-muehe/6155333
#
(ns com.example.graph
"Mucking around with titanium."
{:author "Robert Medeiros" :email "[email protected]"}
(:require
[com.stuartsierra.component :as component])
(:require
[clojurewerkz.titanium.graph :as tg]
[clojurewerkz.titanium.edges :as te]
[clojurewerkz.titanium.vertices :as tv]
[clojurewerkz.titanium.types :as tt]
@crimeminister
crimeminister / aerospike.clj
Created August 12, 2015 04:17
Just playing around with Aerospike from Clojure
(ns aerospike
"Messing around with Aerospike from Clojure"
(:import
[com.aerospike.client AerospikeClient Key Bin Record]))
;; Aerospike Java API docs:
;; http://www.aerospike.com/apidocs/java/
(defn write-data
[key-ns key-set key-user]
@crimeminister
crimeminister / movie-api.clj
Created April 30, 2015 03:02
Problem description when using Pedestal for a simple API
;; I am creating a simple Pedestal service intended to have the following resources:
;;
;; - `/`
;; - `/movies`
;; - `/movies/today`
;; - `/movies/:iso-date` where `:iso-date` matches YYYY-mm-dd
;;
;; The Pedestal routes I have defined using terse format look like so:
(defroutes routes
(defdeps
[[http-kit "2.1.16"]
[org.clojure/clojure "1.6.0"]
[org.clojure/data.json "0.2.5"]])
(ns slack
(:require
[org.httpkit.client :as http]
[clojure.data.json :as json]))
@crimeminister
crimeminister / jenkins.md
Last active September 5, 2019 07:08
Triggering Jenkins builds from git hooks (old blog post)

Triggering Jenkins builds from a git hook

I use Jenkins CI to build a number projects as part of a continuous integration system. I wanted to set things up so that, after each commit to a git repository containing one of these projects, the new code would be checked out and rebuilt by Jenkins (as well as collecting metrics and performing various other tasks). It turns out there’s a very easy way to do this using Git hooks and Jenkins remote build triggers.

Start by setting up a remote build trigger in a Jenkins project. This will enable a URL that, when fetched using an HTTP GET request, will cause Jenkins to build the project. To set things up, visit the Configure page for the project in Jenkins and, under Build Triggers, make sure the Trigger builds remotely option is checked. You’ll need to specify an authentication token to pass as a query parameter. I usually use md5sum to generate an MD5 message digest since they’re random(-ish) and URL-friendly. Make note of the URL that is displayed; that’s what you

Keybase proof

I hereby claim:

  • I am crimeminister on github.
  • I am crimeminister (https://keybase.io/crimeminister) on keybase.
  • I have a public key whose fingerprint is 0E1F A1C6 570A CB2F E397 920C 2974 85D0 A7AF FD3D

To claim this, I am signing this object:

@crimeminister
crimeminister / autoalias.sh
Created August 13, 2014 21:41
examine bash history to obtain most frequently used commands and alias them
# original author: @billiumk
# original idea: @crimeminister
#
# note: this script does not use binbash as the first line because that
# would start a new bash session and we would start with an empty history
if [ $# -eq 1 ]
then
TAILCOUNT="-n $1"
fi
@crimeminister
crimeminister / add2mvn.sh
Created July 18, 2014 19:04
add some JAR files to a local Maven repository (allowing use of unpublished JARs in a Clojure project)
#!/usr/bin/
for file in $(ls lib/*.jar); do
#mvn install:install-file -Dfile=jaad-0.8.3.jar -DartifactId=jaad -Dversion=0.8.3 -DgroupId=jaad -Dpackaging=jar -DlocalRepositoryPath=maven_repository
artifact_id=`basename $file | sed s/\.jar$// | sed -E s/-[0-9]\+\.[0-9]\+\.[0-9]\+//`
version=`basename $file | sed s/\.jar$// | sed -E s/[a-zA-Z\-]*//`
group_id=com.theplatform
local_repo=mvn
mvn deploy:deploy-file -DcreateChecksum=true -Dfile=$file -DartifactId=$artifact_id -Dversion=$version -DgroupId=$group_id -Dpackaging=jar -Durl=file:$loca
l_repo