Skip to content

Instantly share code, notes, and snippets.


Mark Ekisa ivermac

  • ona
View GitHub Profile
ivermac /
Last active Nov 19, 2020
Shell utility commands

check diskspace ubuntu

sudo fdisk -l

sudo lsblk

check files and directories size in a directory in ubuntu

ll --block-size=M

du -hc <directory-path> | sort -rh | head -20

ivermac / ansbile_tips.yml
Created Sep 18, 2020 — forked from bmwant/ansbile_tips.yml
ansible quick tips for some modules
View ansbile_tips.yml
# Check existing
- name: Ansible check file exists.
path: /etc/filename
register: file_status
- debug:
msg: "File exists..."
when: file_status.stat.exists
- debug:
msg: "File not found"

List gpg keys:

gpg --list-keys --keyid-format LONG

Search key in key server:

gpg --search <email>

I'm a mac user and I use crontab -e to render the crone job editor. I added comments that help me remember the cron job pattern/format.

# |minute (0 - 59)
# |
# | |hour (0 - 23)
# | |
# | | |day of month (1 - 31)
# | | |

Killing pm2 god daemon

ps aux | grep -i pm2 | grep <user> | grep -v grep | awk '{print $2}' | xargs kill -9

A small alteration from the github solution given here

ivermac /
Last active Nov 23, 2019
Load and check if a namespace exists
(defn namespace-exists?
  "check that a namespace has been loaded"
  (-> str-val
ivermac /
Last active Nov 23, 2019
Using Clojure to retrieve javascript file names in resources directory
(:require [ :as io])

(defn get-file-names [directory-object files-path]
  (let [full-directory-path (.getPath directory-object)
        get-js-file-path (fn [file]
                           (str files-path (.getName file)))]
    (->> full-directory-path
ivermac /
Created Sep 19, 2019
Resolve and Call symbol derived from a string
clj.user.main=> ((-> "clojure.string/blank?" symbol resolve) "")
clj.user.main=> ((-> "clojure.string/blank?" symbol resolve) "ivermac")

I used Clojure 1.8.0. The example above has been influenced by resolve clojure function

ivermac /
Created Jun 28, 2019 — forked from john2x/
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

ivermac /
Last active Sep 19, 2019
Calling Java vararg function in Clojure

A colleague and I were using Jedis and wanted to delete multiple keys at once without using a loop. The version of Jedis we were using has 2 del functions and the one we wanted use is a java vararg function and can be found here. We understood a Java vararg function as a variadic function in Clojure which simply means a function with infinite arity. Assuming b1 and a1 are keys in redis, the following is what we attempted initially:

(.del jedis "a1" "b1")

The above failed with the following error: IllegalArgumentException No matching method found: del for class redis.clients.jedis.Jedis clojure.lang.Reflector.invokeMatchingMethod (

You can’t perform that action at this time.