Skip to content

Instantly share code, notes, and snippets.

View MartinSeeler's full-sized avatar

Martin Seeler MartinSeeler

View GitHub Profile
@MartinSeeler
MartinSeeler / screen-dimensions.sh
Created August 6, 2013 15:03
some sed and grep games to extract screen dimensions
#!/bin/sh
screen_dim=$(xdpyinfo | grep dimension | awk '{print $2}')
echo "screen size is $screen_dim"
screen_dim_x=$(echo ${screen_dim} | sed -e 's/x/\n/g' | sed -n '1p' )
screen_dim_y=$(echo ${screen_dim} | sed -e 's/x/\n/g' | sed -n '2p' )
echo "screen width is $screen_dim_x"
echo "screen height is $screen_dim_y"
exit 0
@MartinSeeler
MartinSeeler / install-jdk.sh
Created December 29, 2013 19:05
Some utility scripts for the commandline in Linux.
#!/bin/zsh
if [[ -z $1 ]]; then
echo "Please specify the home path of your jdk!"
exit
fi
if [[ ! (-d $1) ]]; then
echo "The directory to the jdk does not exist!"
exit
@MartinSeeler
MartinSeeler / speak-logs
Created September 10, 2014 08:39
Parses text and trims only log message and speaks it out on terminal
head ./foo-bar-log.log | grep -i 'warn' | cut -d '-' -f 4 | awk '{print "Prefix " $0}' | say -v "Zarvox" -r 200
@MartinSeeler
MartinSeeler / problem-08.rs
Last active August 29, 2015 14:10
Euler Problems
fn main() {
let input = "73167176531330624919225119674426574742355349194934969835203127745063262395783180169848018694788518438586156078911294949545950173795833195285320880551112540698747158523863050715693290963295227443043557668966489504452445231617318564030987111217223831136222989342338030813533627661428280644448664523874930358907296290491560440772390713810515859307960866701724271218839987979087922749219016997208880937766572733300105336788122023542180975125454059475224352584907711670556013604839586446706324415722155397536978179778461740649551492908625693219784686224828397224137565705605749026140797296865241453510047482166370484403199890008895243450658541227588666881164271714799244429282308634656748139191231628245861786645835912456652947654568284891288314260769004224219022671055626321111109370544217506941658960408071984038509624554443629812309878799272442849091888458015616609791913387549920052406368991256071760605886116467109405077541002256983155200055935729725716362695618826704282524836008232575304207529

Keybase proof

I hereby claim:

  • I am MartinSeeler on github.
  • I am martinseeler (https://keybase.io/martinseeler) on keybase.
  • I have a public key whose fingerprint is 7044 7B47 E373 C7D5 405E 43CB EC07 FFE7 0FFD CD99

To claim this, I am signing this object:

@MartinSeeler
MartinSeeler / README.md
Last active July 3, 2023 21:36
IntelliJ's "Expand Selection" in Sublime Text

IntelliJ's "Expand Selection" feature in Sublime Text

  1. Install the sublime-expand-region plugin in Sublime Text via Package Control.
  2. Edit Preferences -> Key Bindings - User and add the following to it:
{
  "keys": [
    "alt+up"
  ],
 "command": "expand_region"
@MartinSeeler
MartinSeeler / benchmarks.md
Last active August 29, 2015 14:18
Transducer Benchmark

Transducer Benchmark

These are the results for sbt 'benchmarks/run sB' of transducers-scala on my machine.

Run complete. Total time: 00:05:21

Benchmark (_size) Mode Cnt Score Error Units
TransducersBenchmark.bench_01_noop 100 thrpt 5 528173,865 ± 26017,332 ops/s
TransducersBenchmark.bench_01_noop 10000 thrpt 5 11938,330 ± 15899,449 ops/s
@MartinSeeler
MartinSeeler / AkkaStreamSync.scala
Created August 18, 2015 08:20
Akka stream synchronization
import java.util.concurrent.atomic.{AtomicReference, AtomicInteger, AtomicBoolean}
import akka.actor.Actor.Receive
import akka.actor._
import akka.event.LoggingReceive
import akka.stream.actor.ActorSubscriberMessage.{OnNext, OnError, OnComplete}
import akka.stream.actor._
import akka.stream.actor.ActorPublisherMessage.{Cancel, Request}
import akka.stream.{Outlet, Inlet, Attributes, ActorMaterializer}
import akka.stream.Supervision.Directive
@MartinSeeler
MartinSeeler / konami-cheatcode-rx.js
Created October 2, 2015 10:39
Konami Cheat-Code with RxJs
var cheatCode = [38,38,40,40,37,39,37,39,66,65]; // Konami Cheat Code
Rx.Observable
.fromEvent(document, 'keydown')
.map(function(x) { return x.keyCode; })
.windowWithCount(cheatCode.length, 1)
.flatMap(function(xs) { return xs.toArray(); })
.do(function (x) { console.log(x); })
.filter(function(xs) { return _.isEqual(cheatCode, xs); })
.subscribe(function(x) { console.log('CHEATER!!11elf'); });
@MartinSeeler
MartinSeeler / 0_reuse_code.js
Created October 2, 2015 10:42
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console