Skip to content

Instantly share code, notes, and snippets.

@Mikulas
Mikulas / convert.go
Created November 25, 2022 12:50
Convert Lion's Eye Plain Text into Moxfield compatible deckstats.net CSV
package main
import (
"fmt"
"github.com/tushar2708/altcsv"
"log"
"os"
"strconv"
"strings"
)
@Mikulas
Mikulas / main.go
Created December 27, 2021 23:53
fitbod to hevy import export sync
package main
import (
"bytes"
"encoding/csv"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
@Mikulas
Mikulas / countdown-card.js
Created April 26, 2020 20:47
Home Assistant Lovelace Countdown for Alexa Timer
class CountdownCard extends HTMLElement {
set hass(hass) {
if (!this.content) {
const card = document.createElement('ha-card');
card.header = 'Timer';
this.content = document.createElement('div');
this.content.style.padding = '0 16px 16px';
card.appendChild(this.content);
this.appendChild(card);
}
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
echo "$@"
THISFILE="$(readlink ${BASH_SOURCE[0]} || echo ${BASH_SOURCE[0]})"
REPO_DIR="$( cd "$( dirname "$(dirname "$THISFILE" )" )" && pwd )"
YQ=$(command -v yq-1.15 || command -v yq)
@Mikulas
Mikulas / .bash_profile
Created August 22, 2019 13:06
bash dump
export PYTHONIOENCODING="UTF-8"
export VAULT_ADDR="https://vault.mgit.cz:8200"
export GO111MODULE=on
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
# git identities
if which karn > /dev/null; then eval "$(karn init)"; fi
@Mikulas
Mikulas / patch.sql
Created January 7, 2019 11:42
Disable GitLab profile status (current status)
ALTER TABLE user_statuses
ADD CONSTRAINT "disable_users_statuses" CHECK ("message" = '_disabled_feature_');
bytes srcaddr destaddr
672431 18.194.124.11 172.22.58.146
397891 172.22.58.146 54.36.149.12
259854 172.20.65.159 172.22.58.146
256635 172.20.94.121 172.22.58.146
196342 172.20.94.121 172.22.58.146
103871 172.22.51.161 172.22.58.146
37874 172.22.58.146 172.20.65.159
32806 172.22.58.146 18.194.124.11
28692 172.22.82.116 172.22.58.146
@Mikulas
Mikulas / recreate-nginx.sh
Created February 27, 2018 09:06
Gracefully recreate nginx pod in kubernetes daemonset
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
function test-stable {
for PHASE in $(kubectl -n kube-system get pods -l app=nginx -o json | jq -r '.items[].status.phase'); do
if [[ "$PHASE" != "Running" ]]; then
echo "pod is $PHASE, waiting"
return 1
@@ -1,2 +1,3 @@
session.save_handler = redis
session.save_path = "tcp://redis.k8s.mangoweb.org?prefix=beton-beta."
+max_execution_time = 60
@Mikulas
Mikulas / child.sh
Last active February 8, 2018 19:10
Bash process control
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
source /tmp/x
function handler() {
d " child: caught SIGTERM signal, exiting"
exit 0