Skip to content

Instantly share code, notes, and snippets.

View damesek's full-sized avatar

Bader Szabolcs damesek

View GitHub Profile
@damesek
damesek / shape-e-shark.ipynb
Created October 31, 2023 09:04
shape-e->shark.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@damesek
damesek / memo-cljs-get-post-requests-ajax.clj
Created April 16, 2022 11:30
Clojurescript requests - different types
Memo mainly for me.
If you would like to catch x-http-method-override, then do you need to write one like this ring case:
;from https://github.com/ithaka/artstor-group-service-os/blob/d1251094c8f583ddc9611ace9a6c20d57dd858dc/src/artstor_group_service/util.clj
(defn wrap-method-override
"Ring middleware for method overriding (X-HTTP-Method-Override)"
[handler]
(fn [req]
@damesek
damesek / clojure.service
Last active October 23, 2021 11:21
Run Clojure JAR on Ubuntu with Sytemd
[Unit]
Description=clojure SERVER service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=10
ExecStart=/home/ubuntu/adopt-jdk/jdk-11.0.13+8/bin/java -jar /home/ubuntu/app.jar
@damesek
damesek / libpython-clj-write-xlsm.clj
Last active October 7, 2021 07:51
Write xlsx/ xlsm (template) files from clojure without style or macro loss
(ns playground
(:require [libpython-clj2.python :as py]
[libpython-clj2.require :refer [require-python]]))
(require '[libpython-clj2.python
:refer [as-python as-jvm
->python ->jvm
get-attr call-attr call-attr-kw
get-item
initialize!
#!/usr/bin/env bash
### provision sh HU for vmware or vagrant
### partially "stolen" from Krisztian/ DevopsAcademy
### System
debconf-set-selections <<EOF
locales locales/locales_to_be_generated multiselect en_US.UTF-8 UTF-8, hu_HU.UTF-8 UTF-8
locales locales/default_environment_locale select C.UTF-8
debconf debconf/priority select critical
@damesek
damesek / ex.sh
Created September 2, 2021 08:35
Submit Apple Store iOS app rn-rf-shadow-master
shadow-cljs release app
expo build:ios -t archive
eas submit --platform ios --url {{app S3 location from buid}}
@damesek
damesek / try-debug-macro.clj
Created March 10, 2021 10:20
Try-Catch flow with meta informations:
; define function with tryfn (defn+try-catch+meta)
=> #'microscope.monitor/tryfn<>
(tryfn<>
he [x y] (+ x y))
=> #'user/he
; send data to Sentry etc
(he 2 "a")
@damesek
damesek / practice.clj
Last active March 9, 2021 17:08
swap two character in a string
;; https://gist.github.com/ericnormand/d744381a3a625af105245fe5f9ecc942
;; eric normand
(swap "abc" "a" "b") ;=> "bac"
(swap "book" "k" "t") ;=> "boot"
(swap "Closure" "j" "s") ;=> "Clojure"
(swap "bee" "b" "e") ;=> "ebb"
@damesek
damesek / vec-frequencies-to-map.clj
Last active March 9, 2021 17:09
Vec version of frequencies, plus vec to map transform
(def data [1 2 3 4 3 4 3 4 5 6 7])
(defn -vec-frequencies []
(fn [acc v]
(let [index (.indexOf acc v)
curr-count (if (pos? index)
(first (get acc (inc index)))
0)]
(if (zero? curr-count)
(conj acc v [1])
@damesek
damesek / partition-by-re-implementation.clj
Created March 3, 2021 14:53
Partition-by re-implementation
; Partition by "identity"
(def sdta [1 1 2 2 3 3 2 3 4 4])
(if (= (last (flatten sdata)) 3)
(conj (pop sdata) (conj (peek sdata) 4))
(conj sdata [3]))
(defn -partition-by []
(fn [acc v]