Skip to content

Instantly share code, notes, and snippets.

@tlrobinson
tlrobinson / log-loader.js
Last active August 6, 2018 20:01
webpack logging loader
module.exports = function(source) {
return (
`console.log("Loading: " + ${JSON.stringify(this._module.userRequest)});\n` +
source +
`\nconsole.log("Loaded: " + ${JSON.stringify(this._module.userRequest)});`
);
};
@tlrobinson
tlrobinson / hello.clj
Created July 17, 2018 19:47
java swing in clojure hello world
(javax.swing.SwingUtilities/invokeLater (fn []
(let [frame (new javax.swing.JFrame "HelloWorldSwing")
label (new javax.swing.JLabel "Hello World")]
(.setDefaultCloseOperation frame javax.swing.JFrame/EXIT_ON_CLOSE)
(.add (.getContentPane frame) label)
(.pack frame)
(.setVisible frame true))))
@tlrobinson
tlrobinson / metabase-branch
Last active August 16, 2019 17:40
metabase-branch script for management multiple dev instances of Metabase
#!/usr/bin/env bash
# This script will automatically create a checkout of a Metabase branch, give it
# a unique port, and optionally copy a template database (if a
# `metabase.db.mv.db` exists alongside `metabase-branch`)
#
# If you want to run multiple instances simultaneously you should use
# `foreman run lein run` so that the backend uses the assigned port. You also
# need to use `yarn build-watch` rather than `yarn build-hot`.
#
Ask HN: Why not more popular?
Ask HN: Tips for a Price to License Our Online Game. How Much?
Ask HN: Your thoughts on the deck to raise kids as entrepreneurs?
Ask HN: Any Lenovo engineers here part of speech tagging
Ask HN: What are some good resources?
Ask HN: What benefits did your company to sponsor a visa for a niche startup in exchange for food and shelter if i code for Silicon Valley?
Ask HN: How would you do when you press 'N' and enter?
Ask HN: What is your Linux distro for WiFi on a legacy project?
Ask HN: The best language for drawing vector graphics?
Ask HN: How much to ask retainer fee for being avail during office hours?
Show HN: Infer political party support from $79
Show HN: WooCommerce Shipment Tracking and Crowdfunding Syndicate
Show HN: Stallman Bot – The first iPhone app, Tahrir App
Show HN: Let me read it later
Show HN: CoFoundersLab, matching co-founders one city at a time, with no browser dependencies
Show HN: Volley, a friendly place for foodies to find out what clothing brands fit best
Show HN: Apple Watch apps that you can annotate as you record it from anywhere (incl Caffe integration)
Show HN: Desktop Notifications (webkit) for Hacker News Scope for Ubuntu Phones
Show HN: A simple structural css framework
Show HN: Ginga.js – Middleware framework for creating (Twitter) bots
@tlrobinson
tlrobinson / Dockerfile
Last active May 16, 2018 00:07
pacvim Dockerfile
FROM alpine
RUN apk update
RUN apk add git make g++ ncurses ncurses-dev
RUN ln -s /usr/include/curses.h /usr/include/cursesw.h
RUN git clone https://github.com/jmoon018/PacVim.git /PacVim && cd /PacVim && make install && rm -rf /PacVim
ENTRYPOINT /usr/local/bin/pacvim
@tlrobinson
tlrobinson / iperf3-server
Created April 24, 2018 07:38
docker commands
#!/bin/sh
docker run -it --rm --name=iperf3-server -p 5201:5201 networkstatic/iperf3 -s
from random import randint
import numpy as np
import gdal
import osr
import psycopg2
import requests
def reverse_geocode_osm(coord):
return requests.get(url = "http://nominatim.openstreetmap.org/reverse", params = dict(
format='json',
@tlrobinson
tlrobinson / jooq-in-clojure.clj
Created March 9, 2018 08:23
jooq in clojure
(def conn (java.sql.DriverManager/getConnection "jdbc:postgresql://localhost:5432/db", "", nil))
(def ctx (org.jooq.impl.DSL/using conn org.jooq.SQLDialect/POSTGRES))
(defn parse-sql [query] (.parseQuery (.parser ctx) query))
(defn select [body] (.select ctx body))
(defn inline [value] (org.jooq.impl.DSL/inline value))
(def a (select (inline 1)))
(def b (parse-sql "select 1"))
(log/info a)
@tlrobinson
tlrobinson / prettier-branch.sh
Last active December 13, 2021 00:00
Steps for merging an old branch into a newly prettier-ified codebase. Use at your own risk, verify everything was correctly merged.
# Assumes 3 sequential commits:
#
# 1. commit tagged "prettier-before" that added `prettier` depedency and `prettier` script your package.json
# 2. commit that actually ran `prettier` on your entire codebase for the first time
# 3. commit tagged "prettier-after" that fixes any minor issues caused by prettier (e.x. moving eslint-ignore or $FlowFixMe comments around), or just the next commit if there were none
#
# I recommend running these as individual commands, not as a script, in case of merge conflicts
#
# Checkout the non-pretty branch you want to merge
# (or optionally make a new branch with `git checkout -b $YOUR_BRANCH-prettier $YOUR_BRANCH`)