Skip to content

Instantly share code, notes, and snippets.

View defclass's full-sized avatar
:octocat:
Working from home

Michael Wong defclass

:octocat:
Working from home
View GitHub Profile
@defclass
defclass / pipe_to_docker_examples
Created October 19, 2017 03:14 — forked from ElijahLynn/pipe_to_docker_examples
How to pipe to `docker exec` examples
# These examples assume you have a container currently running.
# 1 Pipe from a file
sudo docker exec --interactive CONTAINER_NAME /bin/bash < the_beginning.sh | tee the_beginning_output.txt`
#2a Pipe by piping
echo "echo This is how we pipe to docker exec" | sudo docker exec --interactive CONTAINER_NAME /bin/bash -
@defclass
defclass / docker_images.sh
Created September 25, 2017 06:49 — forked from hydra1983/docker_images.sh
Save and load docker images in batch
#!/bin/bash
readonly DB_FILE="$(pwd)/images.db"
readonly IMG_DIR="$(pwd)/images"
save-images() {
echo "Create ${DB_FILE}"
echo "$(docker images|grep -v 'IMAGE ID'|awk '{printf("%s %s %s\n", $1, $2, $3)}'|column -t)" > "${DB_FILE}"
echo "Read ${DB_FILE}"
@defclass
defclass / autoreload.clj
Last active July 8, 2017 10:53
autoreload
;; profiles.lcj
;{:repl {:dependencies [;;[org.clojure/tools.trace "0.7.9"]
; [ns-tracker "0.3.1"]]
; :source-paths ["src" "dev-src"]}}
(ns autoreload
(:require [ns-tracker.core :as tracker]))
(defn check-namespace-changes [track]
(try
@defclass
defclass / tmux.md
Created August 28, 2016 01:14 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@defclass
defclass / supervisord.sh
Created June 22, 2016 08:56 — forked from danmackinlay/supervisord.sh
an init.d script for supervisord
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@defclass
defclass / k-means.clj
Last active January 16, 2016 06:55
K-means : An Algorithm for Clustering Data
;; K-means
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; K-means is a Clustering Algorithm.
;; We use it when we have some data, and we want to split the data into separate categories.
;; For instance, an early biologist, let's call him Adam, might measure all
;; sorts of things about the living objects he encounters in the world.