Skip to content

Instantly share code, notes, and snippets.

Gal Dolber galdolber

View GitHub Profile
@galdolber
galdolber / loc.clj
Created Mar 28, 2014
LOC metrics in clojure
View loc.clj
(use '[clojure.java.io])
(defn walk [dirpath pattern]
(doall (filter #(re-matches pattern (.getName %))
(file-seq (file dirpath)))))
(->> (walk "src" #".*\.clj")
(map #(with-open [rdr (reader (file (.getPath %)))]
(count (line-seq rdr))))
@galdolber
galdolber / macro-binding.clj
Last active Aug 29, 2015
Compile time bindings
View macro-binding.clj
(use 'clojure.walk)
(def ^:dynamic clazz)
(defmacro defout [& other]
(binding [clazz (first other)]
(let [other (mapv macroexpand-all other)]
`(~@other))))
(defmacro defin [& other]
View designer.html
<link rel="import" href="../code-mirror/code-mirror.html">
<link rel="import" href="../topeka-elements/category-icons.html">
<link rel="import" href="../core-icon/core-icon.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
View fix.sh
killall ssh-agent gpg-agent
unset GPG_AGENT_INFO SSH_AGENT_PID SSH_AUTH_SOCK
eval $(gpg-agent --daemon --enable-ssh-support)
gpg --batch --decrypt ~/.lein/credentials.clj.gpg
View gist:b9869fed1446d4cfad80
CREATE TABLE IF NOT EXISTS `obras`.`datomic_kvs` (
`id` VARCHAR(640) CHARACTER SET 'ascii' COLLATE 'ascii_bin' NOT NULL,
`rev` INT,
`map` TEXT CHARACTER SET 'utf8mb4' COLLATE 'utf8mb4_bin',
`val` LONGBLOB,
PRIMARY KEY (`id`)) ENGINE=INNODB;
@galdolber
galdolber / webview-for-martin.clj
Created Oct 19, 2015 — forked from jackrusher/webview-for-martin.clj
An example boot-ified Swing app that contains a JavaFX WebView (Webkit instance).
View webview-for-martin.clj
#!/usr/bin/env boot
;; -*- mode: Clojure;-*-
(set-env! :dependencies '[[seesaw "1.4.5"]])
(use 'seesaw.core)
(import '(javafx.scene.web WebView)
'(javafx.scene SceneBuilder)
'(javafx.scene.layout VBoxBuilder))
View profile.clj
{:repl {:plugins [[cider/cider-nrepl "0.10.0"]
[lein-cloverage "1.0.2"]
[lein-kibit "0.0.8"]
[lein-marginalia "0.8.0"]
[lein-bikeshed "0.2.0"]
[lein-capsule "0.1.1"]
[slamhound "1.5.5"]
[lein-droid "0.3.5"]
[lein-exec "0.3.4"]
[jonase/eastwood "0.2.1"]]
@galdolber
galdolber / gist:5564961
Created May 12, 2013
Creates a clojure bimap from an map atom
View gist:5564961
(defn bimap [map-atom]
(let [inv-atom (atom {})]
(add-watch map-atom :bimap
(fn [k r old cur]
(let [o (set (keys old))
n (set (keys cur))]
(doseq [removed (difference o n)]
(swap! inv-atom dissoc (old removed)))
(doseq [added (difference n o)]
(swap! inv-atom assoc (cur added) added)))))
@galdolber
galdolber / root.sh
Created Oct 27, 2016 — forked from Arinerron/root.sh
"Root" via dirtyc0w privilege escalation exploit (automation script) / Android (32 bit)
View root.sh
#!/bin/bash
# Give the usual warning.
clear;
echo "[INFO] Automated Android root script started.\n\n[WARN] Exploit requires sdk module \"NDK\".\nFor more information, visit the installation guide @ https://goo.gl/E2nmLF\n[INFO] Press Ctrl+C to stop the script if you need to install the NDK module. Waiting 10 seconds...";
sleep 10;
clear;
# Download and extract exploit files.
echo "[INFO] Downloading exploit files from GitHub...";
View tmux
set-option -g mouse-select-pane on
set-option -g mouse-select-window on
set-window-option -g mode-mouse on
set -g mouse on
bind -n WheelUpPane if-shell -F -t = "#{mouse_any_flag}" "send-keys -M" "if -Ft= '#{pane_in_mode}' 'send-keys -M' 'select-pane -t=; copy-mode -e; send-keys -M'"
bind -n WheelDownPane select-pane -t= \; send-keys -M
bind -n C-WheelUpPane select-pane -t= \; copy-mode -e \; send-keys -M
bind -t vi-copy C-WheelUpPane halfpage-up
bind -t vi-copy C-WheelDownPane halfpage-down
You can’t perform that action at this time.