Skip to content

Instantly share code, notes, and snippets.

View ip1981's full-sized avatar
🖖
Larga vida y prosperidad

Igor Pashev ip1981

🖖
Larga vida y prosperidad
View GitHub Profile
@ip1981
ip1981 / fromBase64.nix
Last active May 2, 2021 17:09
base64 to hex in nix
strBase64:
let
inherit (builtins)
concatStringsSep genList stringLength substring trace ;
base64 = {
# n=0; for l in {A..Z} {a..z} {0..9} + /; do printf '"%s" = %2s; ' $l $n; (( n++ )); (( n % 8 )) || echo; done
"A" = 0; "B" = 1; "C" = 2; "D" = 3; "E" = 4; "F" = 5; "G" = 6; "H" = 7;
;; this is src/myproject/boot_build.clj
(ns myproject.boot-build
(:require [boot.core :as core]
[cemerick.pomegranate.aether :as aether]
[boot.util :as util]
[boot.pod :as pod]
[clojure.java.io :as io]
[clojure.string :as str]
[cheshire.core :as json]
@ip1981
ip1981 / nagios_range.bash
Last active December 19, 2018 17:18
Parse Nagios plugins ranges in Bash. Only integers
#!/usr/bin/env bash
# Parse Nagios plugins ranges in Bash. Only integers.
# https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT
set -euo pipefail
inrange () {
local r v
local v1 v2
convert xxx.mp4 -coalesce -layers OptimizeFrame xxx.gif
@ip1981
ip1981 / copy-github-issues.sh
Created May 18, 2017 19:25
Copy open github issues between two repositories. Just copy.
#!/usr/bin/env bash
set -euo pipefail
ME=''
GITHUB_API_TOKEN=${GITHUB_API_TOKEN:-}
ACTION=false
CURL=${CURL:-curl}
JQ=${JQ:-jq}
{ config, lib, pkgs, ... }:
let
inherit (builtins) attrNames;
inherit (lib) mkIf concatMapStringsSep;
inherit (config.deployment) keys;
store = "/root/keys";
runkeys = "/run/keys";
#!/usr/bin/env bash
set -euo pipefail
ME=''
GITHUB_API_TOKEN=${GITHUB_API_TOKEN:-}
ACTION=false
CURL=${CURL:-curl}
JQ=${JQ:-jq}
@ip1981
ip1981 / scope.hs
Created April 7, 2015 08:17
Yet another HXT example
import Text.XML.HXT.Core
main = runX $
readDocument [ withValidate no ] "in.xml" >>> addRuntimeScope >>>
writeDocument [ withIndent yes ] "out.xml"
addRuntimeScope = processTopDown (runtimeScope `when` noScope)
runtimeScope = replaceChildren (getChildren <+> scope) where
scope = mkelem "scope" [] [ txt "runtime" ]