Skip to content

Instantly share code, notes, and snippets.

@micrub
micrub / robot.js
Created December 6, 2012 17:30
Enso bot
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(100);
@micrub
micrub / ajax.cljs
Last active August 29, 2015 14:07 — forked from mjg123/ajax.cljs
(def jquery (js* "$"))
(defn show [msg]
(let [data-as-json ((js* "JSON.stringify") msg nil 4)]
((js* "alert") data-as-json)))
(defn make-js-map
"makes a javascript map from a clojure one"
[cljmap]
(let [out (js-obj)]
@micrub
micrub / clojure-ctags.md
Last active June 30, 2016 23:21
Add Clojure support to exuberant ctags and vim-tagbar

ctags

Add the following to ~/.ctags (thanks, xzj / clojure.ctags):

--langdef=Clojure
--langmap=Clojure:.clj
--langmap=Clojure:+.cljx
--langmap=Clojure:+.cljs
--regex-clojure=/\([ \t]*create-ns[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/n,namespace/
--regex-clojure=/\([ \t]*def[ \t]+([-[:alnum:]*+!_:\/.?]+)/\1/d,definition/
@micrub
micrub / README.md
Created May 26, 2017 10:56 — forked from evandrix/README.md
Headless web browsers

Here are a list of headless browsers that I know about:

  • [HtmlUnit][1] - Java. Custom browser engine. JavaScript support/DOM emulated. Open source.
  • [Ghost][2] - Python only. WebKit-based. Full JavaScript support. Open source.
  • [Twill][3] - Python/command line. Custom browser engine. No JavaScript. Open source.
  • [PhantomJS][4] - Command line/all platforms. WebKit-based. Full JavaScript support. Open source.
  • [Awesomium][5] - C++/.Net/all platforms. Chromium-based. Full JavaScript support. Commercial/free.
  • [SimpleBrowser][6] - .Net 4/C#. Custom browser engine. No JavaScript support. Open source.
  • [ZombieJS][7] - Node.js. Custom browser engine. JavaScript support/emulated DOM. Open source.
  • [EnvJS][8] - JavaScript via Java/Rhino. Custom browser engine. JavaScript support/emulated DOM. Open source.
@micrub
micrub / xmonad-default-key-bindings.md
Last active March 28, 2024 15:06
Xmonad default key bindings

xmonad default key bindings

Action key bindings

Key binding Action
mod - shift - slash Run xmessage with a summary of the default keybindings (useful for beginners)
mod - shift - return Launch terminal
mod - p Launch dmenu
mod - shift - p Launch gmrun
@micrub
micrub / jdk-squashfs-ramdisk-ubuntu.md
Last active January 5, 2018 00:54 — forked from lambdaverse/jdk-squashfs-ramdisk-ubuntu.md
JDK and Leiningen on ram disk with Ubuntu 14.04

Overview

  1. Create RAM disk
  2. Create JAVA + Leiningen squashfs image
  3. Mount Image to RAM disk and set it as permanent
  4. Set Java on RAM disk to be default and patch lein executable to read standalone jar from RAM disk.

Create RAM disk

Create RAM disk using tmpfs:

@micrub
micrub / pip-on-babun.md
Last active January 6, 2018 23:59
Install PIP for python for Babun

Manual installation

Tried following which broke python:

pact install python-setuptools python-ming
pact install libxml2-devel libxslt-devel libyaml-devel
curl -skS https://bootstrap.pypa.io/get-pip.py | python
@micrub
micrub / neovim.md
Created February 16, 2018 22:00 — forked from humorless/neovim.md
How to install neovim in Ubuntu-14.04 & using terminal mode

Install neovim in ubuntu 14.04

sudo add-apt-repository ppa:neovim-ppa/unstable 
sudo apt-get update
sudo apt-get install neovim

Using terminal mode

  1. Enter terminal mode
@micrub
micrub / putty-gce.md
Created February 16, 2018 23:09 — forked from feczo/putty-gce.md
How to use Compute Engine - GCE with putty
@micrub
micrub / check-if-a-variable-is-set-in-bash.md
Created February 19, 2018 21:17
check if a variable is set in bash

The right way

if [ -z ${var+x} ]; then echo "var is unset"; else echo "var is set to '$var'"; fi

where ${var+x} is a [parameter expansion][1] which evaluates to nothing if var is unset, and substitutes the string x otherwise.

Quotes Digression

Quotes can be omitted (so we can say ${var+x} instead of "${var+x}") because this syntax & usage guarantees this will only expand to something that does not require quotes (since it either expands to x (which contains no word breaks so it needs no quotes), or to nothing (which results in [ -z ], which conveniently evaluates to the same value (true) that [ -z "" ] does as well)).