Skip to content

Instantly share code, notes, and snippets.

@Velrok
Velrok / Dockerfile
Created December 21, 2014 23:31
Example Dockerfile for a clojure app.
FROM java:7
MAINTAINER Velrok
RUN mkdir -p /opt/mb
ADD ./target/mb.jar /opt/mb/mb.jar
ADD ./VERSION /opt/mb/VERSION
ADD ./public /opt/mb/public
WORKDIR /opt/mb
@Velrok
Velrok / build.sh
Created December 21, 2014 23:30
Example build script for a clojure app via giantswarm.io
#!/bin/bash
set -e
lein ring uberjar
./increment_version.rb $@
docker build --rm=true -t registry.giantswarm.io/velrok/mb:$(cat ./VERSION) .
docker push registry.giantswarm.io/velrok/mb:$(cat ./VERSION)
@Velrok
Velrok / deploy.sh
Created December 21, 2014 23:28
Example deploy script for giantswarm.io
swarm delete -y mb
swarm create --var=version=$(cat ./VERSION) swarm.json
sleep 1
swarm start mb
sleep 1
swarm status mb
@Velrok
Velrok / swarm.json
Created December 21, 2014 23:26
Example swarm config file.
{
"app_name": "mb",
"services": [
{
"service_name": "mb-service",
"components": [
{
"component_name": "mb",
"image": "registry.giantswarm.io/velrok/mb:$version",
"ports": [ "3000/tcp" ],
[{:key :email-consent
:type :yes-no
:tags [#{:application/energy-offline}]
:schema (shared/map-has {:email-consent shared/Yes-No})
:group groups/account
:label "Would you like E.ON to email you account management reminders?"
:help-text "E.ON may also use these details to write to you about your account once your switch is complete."}]
@Velrok
Velrok / autorepl.sh
Created August 6, 2014 14:03
run 'lein repl' on entering a leiningen project folder without a running repl #zsh
# run lein repl if no repl was allready started for this project
function chpwd {
if [[ -e "$(pwd)/project.clj" ]] && [[ ! -e "$(pwd)/.nrepl-port" ]]
then
echo "Detected clojure project but no .nrepl-port -> running: lein repl."
lein repl &
fi
}
@Velrok
Velrok / .ctags
Created May 13, 2014 09:49
ctags file with rudementary clojure support.
--recurse=yes
--tag-relative=yes
--exclude=.git
--langdef=Clojure
--langmap=Clojure:.clj
--regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/
--regex-clojure=/\([ \t]*def[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/d,definition/
--regex-clojure=/\([ \t]*defn-?[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/f,function/
--regex-clojure=/\([ \t]*defmacro[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/m,macro/
@Velrok
Velrok / goto-sleep.sh
Created October 30, 2013 00:28
A bash script for mac that uses an apple script to put the mac to sleep without the need to enter the password.
#!/bin/bash
if [ -n "$1" ]
then
minutes=$(($1 * 60))
echo "going to sleep in $1 minutes"
sleep $minutes
fi
echo "sleeping now"
osascript -e 'tell app "Finder" to sleep'
@Velrok
Velrok / big-data.bib
Created October 2, 2013 13:09
all my latex references are suddenly broken
%% This BibTeX bibliography file was created using BibDesk.
%% http://bibdesk.sourceforge.net/
%% Created for Waldemar S at 2013-10-02 14:53:53 +0200
%% Saved with string encoding Unicode (UTF-8)
@Velrok
Velrok / random_name_generator.clj
Created September 28, 2013 11:45
Random name generator using combining adjectives with animals.
(def adjectives [
"adorable"
"adventurous"
"aggressive"
"alert"
"attractive"
"average"
"beautiful"
"blue-eyed "
"bloody"