Skip to content

Instantly share code, notes, and snippets.

View lhns's full-sized avatar

Pierre Kisters lhns

View GitHub Profile
# Use Generic Template
# Set D1 to Counter
SetOption65 1
timezone 0
TelePeriod 10
Rule1 ON System#Init DO Counter1 0 ENDON ON System#Save DO Counter1 0 ENDON
Rule1 1
CounterDebounce 500
// ==UserScript==
// @name HN Favicons
// @version 0.3
// @license MIT
// @description Favicons for Hacker News
// @match https://*.ycombinator.com/*
// @grant GM.addElement
// ==/UserScript==
for(let link of document.links) {
// ==UserScript==
// @name GitLab: Open with GitHub Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @match http://gitlab.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com
// @grant none
// ==/UserScript==
runParallel() {
local batchSize=1
if [ "$1" == "--batch" ]; then
batchSize="$2"
shift 2
fi
local concurrency="$1"
shift
local tasks=()
local exitCode=0
// ==UserScript==
// @name GitLab: Open with GitHub Desktop
// @namespace http://tampermonkey.net/
// @version 0.1
// @description
// @match https://gitlab.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=gitlab.com
// @grant none
// ==/UserScript==
for i in $(docker container ls --format "{{.ID}}"); do docker inspect -f '{{.State.Pid}} {{.Name}}' $i; done
<!--
* Copyright (c) 2021 GraphQL Contributors
* All rights reserved.
*
* This source code is licensed under the license found in the
* LICENSE file in the root directory of this source tree.
-->
<!DOCTYPE html>
<html>
<head>
@lhns
lhns / xml-json-ast.schema.json
Last active September 16, 2021 11:00
JSON Schema for lossless XML to JSON conversion and vice versa
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$ref": "#/definitions/node",
"definitions": {
"node": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
@lhns
lhns / curlFailWithBody.sh
Last active July 6, 2021 15:01
similar to curl --fail-with-body
#!/bin/bash
curlFailWithBody() {
exec {fd}>&1
local httpCode="$(curl "$@" -w '%{http_code}' -o >(cat >&"$fd"))"
local exitCode="$?"
exec {fd}<&-
if (($exitCode == 0 && ($httpCode < 200 || $httpCode > 299))); then
exitCode=22