Skip to content

Instantly share code, notes, and snippets.

View camsaul's full-sized avatar
💭
I am Cam

Cam Saul camsaul

💭
I am Cam
View GitHub Profile
@camsaul
camsaul / loc.sh
Created May 24, 2018 01:02
How many LOC??
#! /usr/bin/env bash
find -E frontend src test -type f -regex '^.*(js|jsx|clj|css)$' -exec cat {} \; | sed '/^\s*$/d' | wc -l
@camsaul
camsaul / pom.md
Created May 16, 2018 22:00
Making a fake Maven repo to serve a JAR

Generate the POM file:

mvn install:install-file \ 
  -Dfile=RedshiftJDBC42-no-awssdk-1.2.12.1017.jar \
  -DgroupId=com.amazon.redshift -DartifactId=redshift-jdbc42-no-awssdk \
  -Dpackaging=jar \
  -Dversion=1.2.12.1017 \
  -DgeneratePom=true
@camsaul
camsaul / addr.clj
Created April 19, 2018 01:11
Generating real fake addresses
(ns addr
(:require [cheshire.core :as json]
[clj-http.client :as http]
[clojure.java
[io :as io]
[jdbc :as jdbc]]
[clojure.pprint :as pprint]
[metabase.db :as mdb]
[metabase.util.schema :as su]
[schema.core :as s]))
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@camsaul
camsaul / log_requires.clj
Last active March 31, 2021 23:43
Log Clojure requires
(def ^:private ^:dynamic *require-chain* nil)
(defonce new-require
(let [orig-require (var-get #'clojure.core/require)]
(orig-require 'clojure.pprint)
(fn [& args]
(binding [*require-chain* (conj (vec *require-chain*) (ns-name *ns*))]
(let [require-chain-description (apply str (interpose " -> " *require-chain*))]
(println "\nin" require-chain-description)
((resolve 'clojure.pprint/pprint) (cons 'require args))
@camsaul
camsaul / external_ip.sh
Created October 17, 2017 01:01
Get your external IP address
#!/bin/bash
curl ifconfig.me
@camsaul
camsaul / toucan.txt
Last active October 13, 2017 02:10
ASCII Art Toucan
llccc::;,,''.....''''',,,,,,,,,,,,,,,,;;;,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::::::::::::::::::
ccccccc::;;,''...'''''',,,,,,,,,,,,,,,,,,,,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::::::::::::::::
;::cccccc:::;;,''''''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;::::::::::::::::
',,;::cccccc:::;;,,'''''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::::::::::::::
..'',,;::::ccc::::;;,,'''',,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,;;;;;;;;;;;;:::::::::::::;;;;;;;::::::::::::::::
....''',,;;::::::::;;;,,,,,,,,,,,,,,,,,,,,,,,,'',,,'''',,,,;;;;:::::::::::;;;;;;;;;;;;;;;:::::::::::::::::::::::::::::::
'''''''''',,;;::::;;;;,,,,,,,,,,,,,,,,,,,,'''',,;cloodxxkkkkkkkkkkkkkkkxxxxdool:,'........''',,;;:::::::::::::::::::::::
''''''''''''',,;;;;;;,,,,,,,,,,,,,,,,,,,;clodkO0KKXK0OkxdddooooooooooooookKXKK00Okxoc;'..........',;::::::::::::::::::::
'''''''''''''''',,,,,,,,,,,,,,,,,,:codxO0KXXXXK0Okdollll
@camsaul
camsaul / secure_random.sh
Created July 25, 2017 01:20
Generate Secure Random Strings
#!/bin/bash
# base 64
openssl rand -base64 32
# hex
openssl rand -hex 32
@camsaul
camsaul / mac_settings.sh
Last active August 10, 2017 22:43
Mac Settings
#!/bin/bash
# Reminder of the various things to do when setting up a Mac
# Things to install via App Store:
# Patterns
# xCode
# Slack
# System Monitor
# Things to install from web:
@camsaul
camsaul / debug_expectations_tests.clj
Last active March 19, 2018 22:37
Debugging Clojure Expectations Tests (Metabase Codebase)
(def current-test-name (atom nil))
(defonce my-redef
(do (let [orig-fn @#'expectations/test-name]
(intern 'expectations 'test-name
(fn [metta]
(u/prog1 (orig-fn metta)
(reset! current-test-name <>)
(println "Now we're going to run:" <>)))))
:ok))