Skip to content

Instantly share code, notes, and snippets.

View mpenet's full-sized avatar
🪲
breeding bugs

Max Penet mpenet

🪲
breeding bugs
View GitHub Profile
@mpenet
mpenet / gist:3130635
Created July 17, 2012 17:11
worg.css
@media all
{
body {
font-family: "Helvetica Neue", "Lucida Grande", "Lucida Sans Unicode", Helvetica, Arial, sans-serif !important;
font-size: 14px;
line-height: 21px;
color: #333;
max-width: 95%;
margin: auto;
@mpenet
mpenet / gist:5141349
Last active October 16, 2018 16:59
playing with hayt api
{:drop-index :foo}
{:drop-keyspace :foo}
{:drop-table :foo}
{:select (#qbits.hayt.cql.CQLFn{:name COUNT, :args (:*)}), :from :foo}
{:select (:*), :from :foo, :where {:ts #qbits.hayt.cql.CQLFn{:name now, :args nil}}}
{:select (#qbits.hayt.cql.CQLFn{:name WRITETIME, :args (:bar)}), :from :foo}
{:select (#qbits.hayt.cql.CQLFn{:name TTL, :args (bar)}), :from :foo}
{:select (#qbits.hayt.cql.CQLFn{:name unixTimestampOf, :args (bar)} #qbits.hayt.cql.CQLFn{:name dateOf, :args (:bar)}), :from :foo}
{:select (:*), :from :foo, :where {#qbits.hayt.cql.CQLFn{:name token, :args (:user-id)} [#<core$_GT_ clojure.core$_GT_@6177060f> #qbits.hayt.cql.CQLFn{:name token, :args (tom)}]}}
{:select (:*), :from :foo, :where {:ts #qbits.hayt.cql.CQLFn{:name now, :args nil}}}
(defn until
[p]
(fn [rf]
(let [p? (volatile! false)]
(fn
([x] (rf x))
([x y]
(if @p?
x
(do
@mpenet
mpenet / .scaffolding.clj
Created July 11, 2018 15:08
just a hack to use deps.edn dependencies in lein/boot projects without having to rely on half working plugins + versioning from git tags
(require
'[clojure.java.shell :as sh]
'[clojure.edn :as edn])
(set! *warn-on-reflection* true)
(defn next-version [version]
(when version
(let [[a b] (next (re-matches #"(.*?)([\d]+)" version))]
(when (and a b)
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4
# Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below.
font pango:terminus 10
@mpenet
mpenet / gist:674c13bb8cc3b6fefa23f08bbea5446f
Last active February 5, 2018 11:28
like clojure.core sequence but without chunking
(defn unchunked-sequence [xform coll]
(->> coll
(clojure.lang.RT/iter)
(clojure.lang.TransformerIterator/create xform)
(clojure.lang.IteratorSeq/create)))
;; realizes 10 values
(first
(unchunked-sequence (comp (map #(do (prn %) %))
(partition-all 10))
(defmacro ns-local
"Creates a locally aliased namespace matching supplied symbol"
[k]
`(alias ~k (create-ns (symbol (str *ns* "." (str ~k))))))
# Build and slim Erlang
# Change the line below if you want to use a different version of Erlang
# (Keep in mind that patches may not apply cleanly)
erlang_version=otp_src_R14B03
erlang_source_file:=$(PACKAGE_SOURCES)/$(erlang_version)/$(erlang_version).tar.gz
erlang_root=$(GTH_ERLANG_ROOT)/$(erlang_version)
target_prefix=/opt/erlang
@mpenet
mpenet / gist:5793357
Last active December 18, 2015 13:58
Freezing speed up attempt, using non sync versions of bytearray iostream from apache Harmony.
;; example of query that takes results by pairs,
;; and uses the last value of x to create the new chunks, incrementing its value.
(lazy-query (select :items
(limit 2)
(where {:x 1}))
(fn [query coll]
(merge query (where {:x (-> coll last :x inc)}))))