Skip to content

Instantly share code, notes, and snippets.

@pjullah
pjullah / vagrant_disk_sizing.sh
Last active April 24, 2017 15:33
Vagrant Disk Sizing
# On host
$ cd ~/VirtualBox\ VMs/<vm>
$ VBoxManage clonehd "box-disk1.vmdk" "clone-disk1.vdi" --format vdi
$ VBoxManage modifyhd "clone-disk1.vdi" --resize 50000
$ VBoxManage storageattach $(pwd | cut -d "/" -f5-) --storagectl "SATA" --port 0 --device 0 --type hdd --medium clone-disk1.vdi
# On VM
$ vagrant up
$ vagrant ssh
$ sudo su -
@pjullah
pjullah / env.clj
Last active May 3, 2017 11:48
Notes on Clojure development environment configuration
;; https://stuartsierra.com/2016/clojure-how-to-ns.html
;; ns cheatsheet https://gist.github.com/ghoseb/287710/
;; Work with library in REPL - example Cheshire
(boot.core/set-env! :dependencies #(conj % '[cheshire "5.5.0"]))
(require '[cheshire.core])
;; add dependency
(set-env! :dependencies #(conj % '[foo/bar "1.2.3"]))
@pjullah
pjullah / core.async.clj
Last active May 4, 2017 08:51
Notes on using core.async
; Blocking
>!! ; put
<!! ; take
; determine Clojure version
> *clojure-version*
; Look in ~/.m2 to see which Clojure versions are installed.
@pjullah
pjullah / gist:eecd46772959db1691088ac17b8c4c82
Last active May 12, 2017 10:39
Package a Clojure application as a Docker image
#https://juxt.pro/blog/posts/beanstalk.html
FROM java:8

ADD target/myproj.0.1.0-SNAPSHOT-standalone.jar /srv/myproj-app.jar

EXPOSE 8080

CMD ["java", "-jar", "/srv/myproj-app.jar"]
@pjullah
pjullah / readme.md
Last active May 16, 2017 11:39
Example of working with Docker, Boot, and Compojure

Background

https://www.reddit.com/r/Clojure/comments/4j7lyx/docker/

http://www.compoundtheory.com/ - article on Dockerising Clojure

I've been setting up an environment to test out an alternative to CORS for an application I'm developing using Nginx as a reverse proxy in front of three Clojure services. In doing so I needed to setup the backend servers to serve requests. But there was hitch. I was using a Dockerised Nginx which was linking to web service containers. Again, that is working fine.

@pjullah
pjullah / react_notes.md
Last active May 19, 2017 13:18
Some notes about React, Router, Redux, Thunk etc

ReactRouter.withRouter injects route information into wrapped component props.

render() { const { match, location, history } = this.props
const Component = withRouter(Component)

Redux-thunk

@pjullah
pjullah / chapter_1.clj
Created May 23, 2017 13:53
Clojure Applied
(ns clojure-applied.core)
; define a map - values can be looked up in near constant time.
(def earth {
:name "Earth"
:moons 4
:volume 1.083
:mass 5.972
:type :Planet
})
@pjullah
pjullah / chapter_3.clj
Created May 23, 2017 13:57
The Little Schemer
(ns the-little-schema.core)
;;; Chapter 3 - Cons the magnificent
;; 1. Always ask null? as the first question in expressing any function
;; 2. Use cons to build lists
;; 3. When building a list, describe the first typical
;; element, and then cons in onto the natural recursion
@pjullah
pjullah / vim_fireplace_cheat_sheet.md
Created June 8, 2017 09:56
Cheat sheet for vim fireplace

fireplace

  • cpr => (require ... :reload)
  • cpR => (require ... :reload-all)

Evaluation

  • :Eval (clojure code) => runs (clojure code) in repl
  • cpp => evaluate inn-most expessions under cursor
  • cp<movement> => evaluate text described by <movement>
  • cqp => opens quasi-repl
  • cqc => quasi-repl command line window
@pjullah
pjullah / generate_csv.bash
Created June 12, 2017 16:12
Generate some CSV data for testing
for i in {1..999}; do printf '%s\n' "row ${i}" "2011-03-11" ${i} true | paste -sd "," - ; done > data.csv