Skip to content

Instantly share code, notes, and snippets.

@danilkuznetsov
danilkuznetsov / Export data from H2 database into CSV
Last active June 14, 2023 00:23
Export data from H2 database into CSV
CALL CSVWRITE('/home/<user>/downloads/<table_name>'.csv', 'SELECT * FROM <table_name>', 'charset=UTF-8 fieldSeparator=;');
Without field delimiter "
CALL CSVWRITE('/home/<user>/downloads/<table_name>'.csv', 'SELECT * FROM <table_name>', 'charset=UTF-8 fieldSeparator=; fieldDelimiter=');
@robert-stuttaford
robert-stuttaford / config.edn
Last active May 1, 2017 07:07
Using Onyx with Trapperkeeper
{:environment :production
:global {:logging-config "./logback.xml"}
:onyx {:job-scheduler :onyx.job-scheduler/balanced
:task-scheduler :onyx.task-scheduler/balanced
:peer-config {:onyx.messaging/impl :netty
:onyx.messaging/peer-port-range [40200 40220]
:onyx.messaging/peer-ports [40199]
:onyx.messaging/bind-addr "localhost"
:onyx.messaging/backpressure-strategy :high-restart-latency}
:peer-count 20
@runexec
runexec / clojure-transduce-reduce.md
Last active August 16, 2017 22:11
Clojure's Transducers and Reducers

Transducers and Reducers

Notes and examples of Transducers and Reducers

Reducers

  • Used on collections

  • Eager evaluation only. (not lazy)

(ns creator.core
(:require-macros [cljs.core.async.macros :refer [go]])
(:require [om.core :as om :include-macros true]
[cljs.core.async :as async :refer [chan <! >! put!]]
[om-tools.core :refer-macros [defcomponent]]
[cljs.reader :as reader]
[goog.dom :as gdom]
[om-tools.dom :as dom :include-macros true])
(:import [goog.net XhrIo]))
@loganlinn
loganlinn / history.cljs
Last active November 19, 2017 20:13
history.cljs
(ns history
"Light wrappers and utils for js/history")
(defn back! [] (.back js/history))
(defn forward! [] (.forward js/history))
(defn go! [idx] (.go js/history idx))
(defn replace-state!
@allgress
allgress / reagent_datascript.cljs
Last active February 16, 2023 21:16
Test use of DataScript for state management of Reagent views.
(ns reagent-test.core
(:require [reagent.core :as reagent :refer [atom]]
[datascript :as d]
[cljs-uuid-utils :as uuid]))
(enable-console-print!)
(defn bind
([conn q]
(bind conn q (atom nil)))
@L422Y
L422Y / osx_automount_nfs.md
Last active May 10, 2024 09:06
Automounting NFS share in OS X into /Volumes

I have spent quite a bit of time figuring out automounts of NFS shares in OS X...

Somewhere along the line, Apple decided allowing mounts directly into /Volumes should not be possible:

/etc/auto_master (see last line):

#
# Automounter master map
#

+auto_master # Use directory service

(ns logic-play.puzzle
(:refer-clojure :exclude [==])
(:use [clojure.core.logic])
(:require [clojure.tools.macro :as mu]
[clojure.set :as set]
[clojure.core.logic.fd :as fd]))
;; -----
;; CLP(Set) Boilerplate
(defn index [xs] (->> xs (map-indexed (fn [i x] [x (inc i)])) (into {})))
;; Datomic example code
;; Demonstrates using datalog with Clojure defrecords
(use '[datomic.api :only [q db] :as d])
;;; http://www.lshift.net/blog/2010/08/21/some-relational-algebra-with-datatypes-in-clojure-12
(defrecord Supplier [number name status city])
(defrecord Part [number name colour weight city])
(defrecord Shipment [supplier part quantity])
;; sample data
@richhickey
richhickey / codeq-examples.clj
Created November 20, 2012 00:58
codeq examples used in conj talk
(require '[datomic.api :as d])
(require '[clojure.pprint :refer [pprint]])
(def uri "datomic:free://localhost:4334/git")
(def conn (d/connect uri))
(def db (d/db conn))
;; committers
(d/q '[:find ?email
:where
[_ :commit/committer ?u]