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
@fnky
fnky / ANSI.md
Last active May 8, 2024 15:42
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@eatonphil
eatonphil / cl-docker.asd
Last active December 21, 2022 19:49
cl-docker
(defsystem :cl-docker
:depends-on (:cl-ppcre)
:serial t
:components ((:file "package")
(:file "docker")))
@tlrobinson
tlrobinson / Dockerfile
Last active March 12, 2018 22:55
Known working Metabase dev environment
FROM debian:stretch
WORKDIR /root
RUN apt-get update
RUN apt-get install -y git openjdk-8-jre curl gpg build-essential apt-transport-https
RUN curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash -
@camsaul
camsaul / fake-smtp.sh
Created July 13, 2016 22:19
Run local fake SMTP server for debugging
#!/bin/bash
sudo python -m smtpd -n -c DebuggingServer localhost:25
@camsaul
camsaul / which-process-is-listen-on-port.sh
Created January 25, 2016 21:57
Figure out which process is listening to a given TCP port
lsof -i tcp:8090 | grep LISTEN
@sunng87
sunng87 / reflection.clj
Created November 20, 2015 10:04
clojure: access private field/method via reflection
(defn invoke-private-method [obj fn-name-string & args]
(let [m (first (filter (fn [x] (.. x getName (equals fn-name-string)))
(.. obj getClass getDeclaredMethods)))]
(. m (setAccessible true))
(. m (invoke obj args))))
(defn private-field [obj fn-name-string]
(let [m (.. obj getClass (getDeclaredField fn-name-string))]
(. m (setAccessible true))
(. m (get obj))))
@wolever
wolever / pluralize_and_summarize_interval.sql
Created August 27, 2015 20:07
PostgreSQL functions for pluralizing strings and summarizing / humanizing time intervals.
-- > select pluralize(42, 'friend');
-- '42 friends'
-- > select pluralize(1, 'ox', 'oxen');
-- '1 ox'
-- > select pluralize(32, 'is %s thing', 'are %s things')
-- 'are 32 things'
-- > select summarize_interval('interval 12.9 seconds')
-- '12 seconds'
-- > select summarize_interval('interval 3 hours 53 minutes')
-- '3 hours'
@kevincennis
kevincennis / v8.md
Last active May 6, 2024 05:25
V8 Installation and d8 shell usage

Installing V8 on a Mac

Prerequisites

  • Install Xcode (Avaliable on the Mac App Store)
  • Install Xcode Command Line Tools (Preferences > Downloads)
  • Install depot_tools
    • $ git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git
    • $ nano ~/.zshrc
    • Add path=('/path/to/depot_tools' $path)
@okunishinishi
okunishinishi / Remove all git tags
Created March 8, 2014 03:12
Delete all git remote tags
#Delete local tags.
git tag -l | xargs git tag -d
#Fetch remote tags.
git fetch
#Delete remote tags.
git tag -l | xargs -n 1 git push --delete origin
#Delete local tasg.
git tag -l | xargs git tag -d
@markSci5
markSci5 / Git checkout remote branch
Created July 3, 2013 07:08
Git checkout remote branch
//To fetch a branch, you simply need to:
git fetch origin
//This will fetch all of the remote branches for you. With the remote branches
//in hand, you now need to check out the branch you are interested in, giving
//you a local working copy:
git checkout -b test origin/test