Skip to content

Instantly share code, notes, and snippets.

@4mitch
4mitch / ns-cheatsheet.clj
Created April 26, 2019 20:26 — forked from ghoseb/ns-cheatsheet.clj
Clojure ns syntax cheat-sheet
;;
;; NS CHEATSHEET
;;
;; * :require makes functions available with a namespace prefix
;; and optionally can refer functions to the current ns.
;;
;; * :import refers Java classes to the current namespace.
;;
;; * :refer-clojure affects availability of built-in (clojure.core)
;; functions.
package nl.avisi.jira;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import com.atlassian.jira.component.ComponentAccessor;
import clojure.java.api.Clojure;
@4mitch
4mitch / repl_in_java.md
Created January 16, 2019 19:32 — forked from mbobesic/repl_in_java.md
Starting a clojure repl from java

Clojure REPL in java

Dependencies

<dependencies>
  <dependency>
    <groupId>org.clojure</groupId>
    <artifactId>clojure</artifactId>
    <version>1.8.0</version>
 
@4mitch
4mitch / profiles.clj
Created December 21, 2018 13:52 — forked from friemen/profiles.clj
My Leiningen profiles.clj
;; put this into profiles.clj in ~/.lein folder
{:user {:jvm-opts ^:replace ["-Xmx3G"]
:plugins [[cider/cider-nrepl "0.19.0-SNAPSHOT"]
[refactor-nrepl "2.4.0"]
[lein-ancient "0.6.15"]
[jonase/eastwood "0.3.3"]
[lein-pprint "1.2.0"]
[lein-try "0.4.3"]
[lein-cloverage "1.0.13"]]
:middleware [cider-nrepl.plugin/middleware
@4mitch
4mitch / gist:0219bad39682fba214a54751477a545e
Created September 23, 2018 22:48 — forked from ekoontz/gist:1502838
Show your classpath within Clojure REPL.
(use 'clojure.pprint)
(import 'java.lang.Thread)
(-> (Thread/currentThread) (.getContextClassLoader) (.getURLs) (seq) (pprint))
@4mitch
4mitch / gist:949d3faa2dcffc2c090088ebbb2d5e46
Created September 22, 2018 22:18 — forked from noisesmith/gist:d9a804212f3759043053
start a clojure 1.8 socket repl
=> (clojure.core.server/start-server {:name "debug connection" :port 5555 :accept 'clojure.core.server/repl})
#object[java.net.ServerSocket 0x631883f0 "ServerSocket[addr=localhost/127.0.0.1,localport=5555]"]
@4mitch
4mitch / xpath-3.0.ebnf
Created September 11, 2018 21:22 — forked from eerohele/xpath-3.0.ebnf
XPath 3.0 EBNF grammar (Instaparse-compatible except for instaparse/#114)
XPath ::= Expr
ParamList ::= Param ("," Param)*
Param ::= "$" EQName TypeDeclaration?
FunctionBody ::= EnclosedExpr
EnclosedExpr ::= "{" Expr "}"
Expr ::= ExprSingle ("," ExprSingle)*
ExprSingle ::= ForExpr
| LetExpr
| QuantifiedExpr
| IfExpr
@4mitch
4mitch / xpath-3.0.ebnf
Created September 11, 2018 21:22 — forked from eerohele/xpath-3.0.ebnf
XPath 3.0 EBNF grammar (Instaparse-compatible except for instaparse/#114)
XPath ::= Expr
ParamList ::= Param ("," Param)*
Param ::= "$" EQName TypeDeclaration?
FunctionBody ::= EnclosedExpr
EnclosedExpr ::= "{" Expr "}"
Expr ::= ExprSingle ("," ExprSingle)*
ExprSingle ::= ForExpr
| LetExpr
| QuantifiedExpr
| IfExpr
@4mitch
4mitch / Higher Order Functions.ps1
Created August 1, 2018 17:59
Functional programming with Powershell
function Convert-ByFilter($values, $predicate) {
return $values | where { & $predicate $_ }
}
Describe "Higher Order Functions" {
$values = @(1, 2, 3, 4)
It "Should filter even" {
$evenPredicate = { param($value) return $value % 2 -eq 0 }
$even = Convert-ByFilter $values $evenPredicate
@4mitch
4mitch / Install_Alpine_Linux_3.3_on_VirtualBox_OSX.md
Created July 12, 2018 08:46 — forked from kennwhite/Install_Alpine_Linux_3.3_on_VirtualBox_OSX.md
Howto: Install Alpine Linux 3.3 on VirtualBox OSX

Howto: Install Alpine Linux 3.3 on VirtualBox OSX

  • Latest Standard ISO version x86_64 is recommended (http://alpinelinux.org/downloads/)
  • Create new VM ("Linux 2.6 / 3.x / 4.x (64-bit)")
  • 1 CPU w/ 512BM RAM and 1 GB default (VDI) disk is more than sufficient
  • Default networking (NAT)
  • Boot and add Alpine ISO as attached virtual install media
  • Default root password is blank (though note - ssh PermitRootLogin defaults to disallow blank passwords and: prohibit-password; switch to yes for Host ssh)
  • Run setup-alpine
  • Defaults are fine, but you do want "sys" disk setup to sda, y to confirm