Skip to content

Instantly share code, notes, and snippets.

View romansky's full-sized avatar
🐕
walking the dog

Roman Landenband romansky

🐕
walking the dog
View GitHub Profile

Keybase proof

I hereby claim:

  • I am romansky on github.
  • I am romansky (https://keybase.io/romansky) on keybase.
  • I have a public key ASBP1AbR3irB2rz-ajLRPWA370YHkQM0lyTAh92y5R6ajAo

To claim this, I am signing this object:

// the test helper class
import akka.actor._
import akka.io.IO
import java.util.concurrent.atomic.AtomicInteger
import spray.can.Http
import spray.http.{Uri, HttpMethod, HttpResponse, HttpRequest}
object Helpers {
@romansky
romansky / QuickSortScalaMedian.scala
Created February 18, 2013 06:51
QuickSort + Median pivot selection, in Scala
def findMedian (array :Array[Int], lpos: Int, rpos: Int) : (Int, Int) = {
val first : Int = array(lpos)
val last : Int = array(rpos)
val middle : Int = array( lpos + scala.math.floor((rpos-lpos)/2).toInt )
if ((first > last && first < middle) || (first < last && first > middle)) (first,lpos)
else if ((last > first && last < middle) || (last < first && last > middle)) (last,rpos)
else if ((middle > first && middle < last)|| (middle < first && middle > last)) (middle, lpos + scala.math.floor((rpos-lpos)/2).toInt)
else { (first,lpos) }
}
@romansky
romansky / inversionCount.coffee
Created February 5, 2013 18:10
MergeSort + inversion counter, implemented in CoffeeScript
nums = [0,3,2,1,4,5,6,7,8,9]
inversions = [0]
mergeSort = (list,p,r,inver)->
if p < r
q = Math.floor((p + r) / 2)
mergeSort(list,p,q,inver)
mergeSort(list,q + 1,r,inver)
merge(list,p,q,r,inver)
@romansky
romansky / mergeSort.coffee
Last active December 12, 2015 04:28
Recursive merge sort, written in CoffeeScript
nums = [8,7,9,6,5,4,3,2,1,0]
mergeSort = (list)->
if list.length <= 1 then return list
left = []
right = []
for x in list
if left.length < Math.floor(list.length / 2) then left.push(x)
else right.push(x)
left = mergeSort(left)
@romansky
romansky / .tmux.conf
Created September 21, 2012 22:02
my tmux config
set -g status-interval 2
set -g status-right "#S #[fg=green,bg=black,bright]#(tmux-mem-cpu-load 2 8)#[default]"
bind R source-file ~/.tmux.conf \; display-message "Config reloaded..."