Skip to content

Instantly share code, notes, and snippets.

View nightscape's full-sized avatar

Martin Mauch nightscape

View GitHub Profile
author = "joe"
repos = Dir["**/.git/"].map {|r| r.gsub('.git','') }
stats = repos.map {|r| [r, `cd #{r} && git log --author=#{author} --format=format:"%ad %s" --date=short`.split("\n")]}
commits = stats.flat_map {|r, cs| cs.map {|c| d,cm = c.match(/(\d{4}-\d{2}-\d{2}) (.*)/).to_a[1..2]; [d, File.basename(r), cm]}}
str = commits.sort_by(&:first).map {|c| c.join("\t")}.join("\n")
File.open("commits_#{author}.txt", 'w') {|f| f.puts str}
import com.google.appsscript.adwords._
import com.google.appsscript.base.Logger
import com.google.appsscript.spreadsheet._
object ScalaJSExample extends js.JSApp{
def main(): Unit = {
val adsIterator = AdWordsApp.ads()
.withCondition("ApprovalStatus = DISAPPROVED")
.get()
{
"metadata" : {
"name" : "ClasspathTest",
"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"
},
@nightscape
nightscape / HingeQuadraticOptimization.scala
Created May 16, 2015 08:32
Breeze Hinge Quadratic Optimization as described in http://www.stat.colostate.edu/~meyer/hingerev2.pdf, ported from R
import breeze.linalg._
import breeze.numerics._
import scala.annotation.tailrec
/**
* quadratic programming code: hinge algorithm
* find theta to minimize t(theta) * qmat * theta - 2* theta * cvec
* subject to amat * theta >= 0
*
* qmat must be positive definite, amat must be irredicible
*
@nightscape
nightscape / x
Created November 18, 2008 10:51
CmdUtils.makeSearchCommand({
name: "pickaxe",
url: "http://www.google.com/search?q=site:http://whytheluckystiff.net/ruby/pickaxe/%20{QUERY}&btnG=Search&btnI=3564",
icon: "http://whytheluckystiff.net/favicon.ico",
description: "Searches 'Programming Ruby The Pragmatic Programmer's Guide' for your words.",
preview: function(pblock, directObject) {
var searchTerm = directObject.text;
var pTemplate = "Searches 'Programming Ruby The Pragmatic Programmer's Guide' for ${query}";
var pData = {query: searchTerm};
pblock.innerHTML = CmdUtils.renderTemplate(pTemplate, pData);
@nightscape
nightscape / update
Created February 21, 2011 13:47
Server side Git update hook which rejects pushes without prior pulls from master
refname="$1"
oldrev="$2"
newrev="$3"
# Find out revision of master
masterref=`git show-ref --hash --heads master`
# Find out common merge base of master and the checked in revision.
mergebase=`git merge-base $masterref $newrev`
if [[ $mergebase != $masterref && ( $refname == *development* || $refname == *feature* ) ]]
then
echo "Cannot push changes. Merge base is $mergebase, master is $masterref. Please type 'git pull origin master' and merge any conflicts first before$
@nightscape
nightscape / Gui.scala
Created November 29, 2012 01:44 — forked from fnumatic/Gui.scala
Simple Swing Application with scala.react * github.com/ingoem/scala-react
import MySwingDomain._
object Gui extends ReactiveSwingApp {
val button = new MyButton("test")
def top = new MainFrame {
contents = new FlowPanel {
contents += button
}
}
@nightscape
nightscape / Gui.scala
Created November 29, 2012 01:44 — forked from fnumatic/Gui.scala
Simple Swing Application with scala.react * github.com/ingoem/scala-react
import MySwingDomain._
object Gui extends ReactiveSwingApp {
val button = new MyButton("test")
def top = new MainFrame {
contents = new FlowPanel {
contents += button
}
}
@nightscape
nightscape / Plot graph with D3.snb
Last active December 4, 2015 12:47
Graphical exploration of Bayesian Networks in Spark Notebook
{
"metadata" : {
"name" : "Plot graph with D3",
"user_save_timestamp" : "2014-12-15T00:55:09.510Z",
"auto_save_timestamp" : "2014-12-15T00:50:41.883Z",
"language_info" : {
"name" : "scala",
"file_extension" : "scala",
"codemirror_mode" : "text/x-scala"
},
@nightscape
nightscape / usr_share_X11_xkb_compat_misc
Created January 3, 2016 02:23
Tweaked NEO keyboard layout for Linux with working CTRL+SHIFT+Mod4Navigation
default partial xkb_compatibility "misc" {
virtual_modifiers Alt,Meta,Super,Hyper,ScrollLock;
// Interpretations for some other useful keys.
interpret Terminate_Server {
action = Terminate();
};