Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
function adjust_mod_dirnames () {
local MANIF= MOD_DIR= EXPECTED=
local -A MOD_INFO=()
for MANIF in */info.json; do
MOD_DIR="${MANIF%/*}"
eval MOD_INFO=( $(<"$MANIF" tr -s '{},' '\n' | sed -nre '
s~^\s*"([a-z0-9_]+)":\s*"([ !#-Z_-z]*)"\s*$~[\1]=\x27\2\x27~p') )
// -*- coding: utf-8, tab-width: 2 -*-
import 'p-fatal';
import aux from './02_depth_aux';
import pProps from './03_depth_naive';
const { deepDump, identity, soon, detectState } = aux;
const deployment = soon({
@mk-pmb
mk-pmb / my_script.sh
Last active November 27, 2018 00:04
npm script
#!/bin/bash
# -*- coding: utf-8, tab-width: 2 -*-
SPACE="${*//[^ ]/ }"
echo "####${SPACE// /#}####"
echo "## $SPACE ##"
echo "## $* ##"
echo "## $SPACE ##"
echo "####${SPACE// /#}####"
#!/usr/bin/env nodemjs
// -*- coding: utf-8, tab-width: 2 -*-
import test from 'p-tape';
import 'p-fatal';
import pDelay from 'promise-delay';
function stubAsyncDataSource(x) { return pDelay(200, x); }
@mk-pmb
mk-pmb / 01_bug.mjs
Created August 20, 2018 18:28
npm:tunnel@0.0.5: .httpsOverHttp uses port 80 as default for CONNECT
import 'p-fatal'
import proxyTunnels from 'tunnel'
import got from 'got'
const tunnelCfg = {
proxy: {
host: 'localhost',
port: 7777,
proxyAuth: 'guest:yolo',
},
@mk-pmb
mk-pmb / 01_shout.cs
Last active April 21, 2018 16:47
Mono stdin strangeness, Wine bug #45039 https://bugs.winehq.org/show_bug.cgi?id=45039
using System;
using System.IO;
namespace shout
{
class Program
{
static void Main()
{
// reopenStdin(maxLineLen: 4 * 1024);
@mk-pmb
mk-pmb / 180404-001.user.js
Last active April 4, 2018 21:26
ViolentMonkey debugging
// ==UserScript==
// @name ScriptMonkey foo test 180404-001
// @description test
// @namespace spaceweb.pimpmybyte.de
// @match *://spaceweb.pimpmybyte.de/*
// @match *://github.com/*
// @match *://gist.github.com/*
// @version 1
// @resource some-resource.js some-resource.js
// @grant GM_xmlhttpRequest
@mk-pmb
mk-pmb / speak_hello.vbs
Last active April 2, 2018 15:57
MS Speech SDK v5.1 demo in wine
Wscript.Echo "Gonna import the DLL."
set voice = WScript.CreateObject("Sapi.SpVoice")
Wscript.Echo "imported."
Wscript.Echo "Begin config."
' voice.Voice = voice.GetVoices().Item(i)
' voice.AudioOutput = voice.GetAudioOutputs().Item(i)
voice.Rate = 0
var relPath = require('absdir')(module, '.'),
serveStaticFiles = require('ecstatic')({ root: relPath('public') }),
httpLogFormat = 'short',
logHttpRequests = require('morgan')(httpLogFormat),
httpStack = require('stack')(
logHttpRequests,
serveStaticFiles
),
'use strict';
const PgClient = require('pg').Client;
module.exports = function makeHelpers() {
var hlp = { ctx: null };
hlp.connectToDatabase = async function (dbCfg){
const dbClient = new PgClient({
host : dbCfg.host,