Skip to content

Instantly share code, notes, and snippets.


Łukasz Korecki lukaszkorecki

Block or report user

Report or block lukaszkorecki

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View rec.clj
user=> (defrecord Foo [foo bar])
user=> (def f (->Foo :foo :bar))
user=> (defrecord Qux [foo bar baz])
user=> (def q (map->Qux (select-keys f [:foo :bar])))
user=> (clojure.pprint/pprint q)
{:foo :foo, :bar :bar, :baz nil}
View sigh.rb
class SomeDataThing < OpenStruct
include ActiveModel::Validations
validates :name, presence: true
validates :email, presence: true
end "I'm tired").valid? # => false
lukaszkorecki / .circle.yml
Last active Aug 10, 2019
How to setup code coverage for Clojure + Cloverage + CircleCI + CodeClimate
View .circle.yml
version: 2
- image: circleci/clojure:lein-2.7.1
- CC_TEST_REPORTER_ID=....set in project settings....
View app-project.clj
(defproject some-app "0.1.0"
:description "FIXME: write description"
:url ""
:license {:name "Eclipse Public License"
:url ""}
:repositories [["bintray"
{:url ""
:snapshots true
:username :env/bintray_username
:password :env/bintray_api_key}]]
View lib-project.clj
(defproject some-lib "0.1.0"
:description "FIXME: write description"
:url ""
:deploy-repositories [["releases"
:sign-releases false
:username :env/bintray_username
:password :env/bintray_api_key}]
lukaszkorecki / receiver.clj
Created Jun 6, 2017 — forked from stingh711/receiver.clj
A simple UDP server in clojure
View receiver.clj
(import '( DatagramSocket DatagramPacket))
(def socket (DatagramSocket. 5200))
(def running (atom true))
(def buffer (make-array Byte/TYPE 1024))
(defn parse [packet]
(println (String. (.getData packet) 0 (.getLength packet))))
(defn start-receiver []
View aleph.proxy.clj
(require '[aleph.http :as http])
(require '[ring.middleware.cookies :as cookies])
;; serv is a component which wraps aleph.http.server creation/teardown
(def ECHO (component/start (serv/create "ECHO" {:port 3037
:handler (fn [req]
(log/info req)
{:status 200 :body "ok" })})))
lukaszkorecki /
Last active Apr 30, 2017
Fast and easy socks proxy setup on OSX: enables proxy, starts the proxy connection and cleans up after itself when its done
#!/usr/bin/env bash
# Enable SOCKS tunnel for given interface, ssh to a remote machine
# and open a SOCKS proxy.
# When cancelled it will disable proxy settings for given interface
# Start with sudo if you want it to modify all settings for you
# or just run to be prompted on all settings changes
user= # ssh user
host= # ssh host
jq -r '(map(keys) | add | unique) as $cols | map(. as $row | $cols | map($row[.])) as $rows | $cols, $rows[] | @csv' team.json > foo.csv
View temp-files.clj
(defn create-tmp-file
"Create tmp file. Return path to the file!
Note file is deleted when JVM terminates"
[prefix suffix]
(let [file (File/createTempFile prefix suffix)]
(.deleteOnExit file)
(.getPath file)))
(defn create-tmp-directory
You can’t perform that action at this time.