Skip to content

Instantly share code, notes, and snippets.

##
## Arch Linux repository mirrorlist
## Generated on 2013-07-08
##
## Germany
#Server = https://archlinux.limun.org/$repo/os/$arch
## Greece
#Server = https://foss.aueb.gr/mirrors/linux/archlinux/$repo/os/$arch
### Keybase proof
I hereby claim:
* I am oskarth on github.
* I am oskarth (https://keybase.io/oskarth) on keybase.
* I have a public key whose fingerprint is 7CAA 3C75 564F EBB4 1A33 7C4C 9C20 D0AD 8A36 E0E4
To claim this, I am signing this object:

Keybase proof

I hereby claim:

  • I am oskarth on github.
  • I am oskarth (https://keybase.io/oskarth) on keybase.
  • I have a public key whose fingerprint is 7CAA 3C75 564F EBB4 1A33 7C4C 9C20 D0AD 8A36 E0E4

To claim this, I am signing this object:

@oskarth
oskarth / scalawtf
Created May 10, 2014 11:53
scala new wtf 5minutes later
>sbt new progfun
Getting org.scala-sbt sbt 0.13.2 ...
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/sbt/0.13.2/jars/sbt.jar ...
[SUCCESSFUL ] org.scala-sbt#sbt;0.13.2!sbt.jar (2719ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/main/0.13.2/jars/main.jar ...
[SUCCESSFUL ] org.scala-sbt#main;0.13.2!main.jar (13122ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.2/jars/compiler-interface-bin.jar ...
[SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.2!compiler-interface-bin.jar (2064ms)
downloading http://repo.typesafe.com/typesafe/ivy-releases/org.scala-sbt/compiler-interface/0.13.2/jars/compiler-interface-src.jar ...
[SUCCESSFUL ] org.scala-sbt#compiler-interface;0.13.2!compiler-interface-src.jar (1525ms)
@oskarth
oskarth / coin-change.dot
Last active August 29, 2015 14:01
Coin change
digraph {
label="Counting change: 100 cents in quarters and dime";
1 [label="100, (10, 25)"];
2 [label="100, 25"];
3 [label="90, (10, 25)"];
4 [label="100, -"];
@oskarth
oskarth / webframework.clj
Created May 25, 2014 20:14
webframework.clj
(ns webframework.core
(require [clojure.string :refer [split]]
[ring.adapter.jetty :refer [run-jetty]]
[ring.middleware.params :refer [wrap-params]]))
;; Every dependency is one cheat point.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; framework questionmark
@oskarth
oskarth / shuffle.c
Last active September 24, 2015 17:08
Question on Uniform in-place shuffle of array in C - stats vs empirical results
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
/*
We want to do an in-place uniform shuffle of an array.
Claim: with three elements, we have 3 calls to get_random(0, 2). Three random
choices and three possibilities. Total number of possible sets of choices is
3*3*3=27 How many possible outcomes? 3! = 6. 27 not evenly divisible with 6, so

Using cljs.jar, version 1.7.48.

Desired behavior: ability to watch a single cljs file for changes, without any additional directories.

I'm aware that:

  1. java -cp cljs.jar:src clojure.main watch.clj is the normal command to run.
  2. Single-segment namespaces are not normally recommended.

With that said, it would be very neat to be able to have just a single cljs file and a temporary out directory. How do you best achieve this? What changes have to be made to the FS watcher?

@oskarth
oskarth / rands.py
Created March 20, 2016 16:08
Precomputing a series of 5 As and 5 Bs in a secret random order.
# Usage:
# python rands.py
#
# head -n 1 output
# head -n 2 output
# etc...
import random
f = open('output', 'w')
lst = [0]*5 + [1]*5
@oskarth
oskarth / flushfun.clj
Created July 13, 2016 15:35
Flush fun lightning talk
(ns flushfun.core
(:require [clojure.core.async :refer [chan go go-loop close! <!! timeout]]
[amazonica.aws.sqs :as sqs]))
(def queue (sqs/find-queue {:endpoint "eu-west-1"} "flushfun"))
(defn commit-fn [message] (fn [] (sqs/delete-message (assoc message :queue-url queue))))
(defn flush-messages [{:keys [messages commits]}]
(println "FLUSHING" (map :body messages))