Skip to content

Instantly share code, notes, and snippets.

Avatar
🖖
Larga vida y prosperidad

Igor Pashev ip1981

🖖
Larga vida y prosperidad
View GitHub Profile
@ip1981
ip1981 / scope.hs
Created Apr 7, 2015
Yet another HXT example
View scope.hs
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" ]
@ip1981
ip1981 / fromBase64.nix
Last active May 2, 2021
base64 to hex in nix
View fromBase64.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;
View ghprapprove.sh
#!/usr/bin/env bash
set -euo pipefail
ME=''
GITHUB_API_TOKEN=${GITHUB_API_TOKEN:-}
ACTION=false
CURL=${CURL:-curl}
JQ=${JQ:-jq}
View persistentKeys.nix
{ config, lib, pkgs, ... }:
let
inherit (builtins) attrNames;
inherit (lib) mkIf concatMapStringsSep;
inherit (config.deployment) keys;
store = "/root/keys";
runkeys = "/run/keys";
@ip1981
ip1981 / copy-github-issues.sh
Created May 18, 2017
Copy open github issues between two repositories. Just copy.
View copy-github-issues.sh
#!/usr/bin/env bash
set -euo pipefail
ME=''
GITHUB_API_TOKEN=${GITHUB_API_TOKEN:-}
ACTION=false
CURL=${CURL:-curl}
JQ=${JQ:-jq}
@ip1981
ip1981 / nagios_range.bash
Last active Dec 19, 2018
Parse Nagios plugins ranges in Bash. Only integers
View nagios_range.bash
#!/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
View boot_build.clj
;; 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]