Skip to content

Instantly share code, notes, and snippets.

@artbikes
artbikes / Makefile.version
Created March 28, 2022 16:48 — forked from grihabor/Makefile.version
Makefile to use for incremental semantic versioning
MAKE := make --no-print-directory
DESCRIBE := $(shell git describe --match "v*" --always --tags)
DESCRIBE_PARTS := $(subst -, ,$(DESCRIBE))
VERSION_TAG := $(word 1,$(DESCRIBE_PARTS))
COMMITS_SINCE_TAG := $(word 2,$(DESCRIBE_PARTS))
VERSION := $(subst v,,$(VERSION_TAG))
VERSION_PARTS := $(subst ., ,$(VERSION))
@artbikes
artbikes / rubix.py
Created October 14, 2021 18:32 — forked from fogleman/rubix.py
Simple 2x2x2 Rubik's Cube Solver in Python
import sys
# -------
# | 16 17 |
# | Y |
# | 18 19 |
# ------- ------- ------- -------
# | 12 13 | 00 01 | 04 05 | 08 09 |
# | X | Z | X | Z |
# | 14 15 | 02 03 | 06 07 | 10 11 |
@artbikes
artbikes / _CLI_Elasticsearch_Analysis.md
Created July 29, 2021 21:23 — forked from dcode/_CLI_Elasticsearch_Analysis.md
Analyze Elasticsearch on command line using HTTPie and jq

README

Especially when developing new query logic, it's helpful to query elasticsearch from the command line. If your Elasticsearch cluster uses SAML authentication or some other SSO, it's not simple or sometimes not even possible to query using curl directly. I wrote an auth plugin for HTTPie that should greatly simplify this process if you have rights to create API keys via the Kibana dev console (talk to your administrator and see the link below).

This process is also super handy for shell scripting because you can provide fine-grained limits of what your API key can do, making their use much safer and easier to manage than embedding native realm username/passwords.

(ns ansible.core
(:require [clojure.java.shell :as sh]
[clojure.string :as str]
[cheshire.core :as cheshire]
[clojure.java.io :as io])
(:import (java.io File)
(com.fasterxml.jackson.core JsonGenerator)
(java.util Base64)
(java.security MessageDigest MessageDigest$Delegate)))
@artbikes
artbikes / init.lua
Created March 15, 2021 18:43 — forked from nyergler/init.lua
My Hammerspoon window management configuration
hs.hotkey.bind({"cmd", "alt", "ctrl"}, "W", function()
hs.alert.show(
"Hello World!",
{
textFont= "Comic Sans MS",
textSize=72,
fadeOutDuration=1
}
)
end)

Conjure Cheat Sheet

All prefixed by local leader, which is \ in my case.

:disconnect "cd"
:connect-port-file "cf"
:interrupt "ei"
:last-exception "ex"
:view-source "es"
@artbikes
artbikes / docker-mongodump
Created December 31, 2020 19:47 — forked from balos1/docker-mongodump
Dumps a mongodb database from a docker data container / restores a mongodb database dump to a docker data container.
#!/bin/bash
# Run like so:
# docker-mongodump <mongo container name> <path to backups>
MONGO_CONTAINER=$1
BACKUPS_PATH=$2
DAY=`/bin/date +%Y%m%d`
PAST_DAY=`/bin/date -d '3 days ago' +%Y%m%d`
@artbikes
artbikes / wemos_pins.ino
Created December 4, 2020 15:59
arduino to wemos pin mapping
/*
Below are the mapped pins:
Arduino = 0 -> WeMos = D3
Arduino = 1 -> WeMos= NC
Arduino = 2 -> WeMos= D4 (LED)
Arduino = 3 -> WeMos= NC
Arduino = 4 -> WeMos= D2
Arduino = 5 -> WeMos= D1
Arduino = 6 -> WeMos= Watchdog(4) Reset
Arduino = 7 -> WeMos= Watchdog(4) Reset
4/6/2020 11137
4/11/2020 20814
4/14/2020 30087
4/19/2020 41179
4/23/2020 50359
4/29/2020 61594
5/5/2020 72204
5/10/2020 80504
5/17/2020 90482
5/27/2020 101850
@artbikes
artbikes / prometheus.yaml
Created June 18, 2020 20:47
prometheus traefik
# static configuration
global:
checkNewVersion: true
serversTransport:
insecureSkipVerify: true
entryPoints:
traefik: