Skip to content

Instantly share code, notes, and snippets.

gja /
Created Oct 24, 2018
Get fonts from Google Font in woff2 and woff
#!/bin/bash -e
function getCSSFile() {
curl -sH "User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:27.0) Gecko/20100101 Firefox/27.0" "$@"
echo ---------------------
curl -sH "User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36" "$@"
function mergeCSSfiles() {
gawk -f <(cat << EOF
gja / paste-in-console.js
Created Jan 18, 2018
Print out the Barbie
View paste-in-console.js
deleteElement = (elem) => elem.parentElement.removeChild(elem)
gja / infinite-scroll.js
Last active Nov 22, 2017
React Infinite Scroll with IntersectionObserver
View infinite-scroll.js
const React = require("react");
// An item in the infinite scroll
class ScrollItem extends React.Component {
constructor(props) {
this.state = {
minHeight: props.minHeight
gja /
Last active Nov 11, 2017
Cat Mode on OSX
  1. Install Karabiner-Elements
  2. Save this as your ~/.config/karabiner/karabiner.json
  3. Launch Karabiner-Elements
  4. You will have a profile called Cat Mode which disables all keys except the power button

There is a github repo which was a Karabiner extension I borrowed some inspiration from. I'll link to it if I find it again.

gja / volume.clj
Created Apr 28, 2017
Find the shortest path to a certain volume
View volume.clj
(defn- neighboring-edges [node capacity]
(for [i (range (count capacity))
j (range (count capacity))
:when (not= i j)]
(let [total-amount (+ (get node i) (get node j))
amount-in-j (min total-amount (get capacity j))
amount-in-i (- total-amount amount-in-j)]
{:node (assoc node i amount-in-i j amount-in-j)
:pour [i j]})))
gja / main.go
Last active Dec 15, 2016
Program Showing Of Go Pipelining
View main.go
package main
import (
func producer(output_channel chan <- int) {
for i := 0; i < 100; i++ {
gja / log4j2.xml
Last active Sep 25, 2015
log4j2 and ryslog2
View log4j2.xml
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="WARN">
<Syslog name="syslog" host="localhost" port="4242" protocol="UDP" format="RFC5424" enterpriseNumber="18060" appName="quest" mdcId="quest">
<KeyValuePair key="thread" value="%t"/>
<KeyValuePair key="name" value="%c"/>
<Async name="AsyncUDPAppender">
gja / core.clj
Last active Dec 16, 2017
Building a lein uberjar without any compilation
View core.clj
(ns simplequest.core)
(defn -main
"I don't do a whole lot ... yet."
[& args]
(println "Hello, World!"))
gja /
Created Jun 28, 2014
Command to combine PDFs
/System/Library/Automator/Combine\ PDF\ Pages.action/Contents/Resources/ --output output.pdf $@
gja / plot-yourkit-heap.gnuplot
Created Jun 26, 2014
Plot a Yourkit Memory Heap CSV
View plot-yourkit-heap.gnuplot
#! /usr/bin/env gnuplot
set terminal png size 1024,768 font "/Library/Fonts/Arial.ttf" 12
set output "output.png"
set style line 1 lt 1 lw 2 pt 7 pi -1 ps 1.5
set pointintervalbox 3
set datafile separator ','