Skip to content

Instantly share code, notes, and snippets.

@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,
@mk-pmb
mk-pmb / maxconc.log
Created January 12, 2018 01:53
npm bug 18903 worked around using tcpfwd-maxconc-pmb v0.2.1
$ nodejs -r tcpfwd-maxconc-pmb -e 0 max_conc=25 lsn_port=8117 tgt_idle=5
02:45:08 Target connections are reclaimed after 5 seconds of idleness.
02:45:08 Gonna listen on TCP localhost:8117 --{maxConc=25}--> TCP localhost:8118
02:45:08 Listening. 127.0.0.1:8117 --{maxConc=25}--> TCP localhost:8118
02:45:15 Guest 0: 127.0.0.1:46428 enqueued. remaining seats: 25, remaining waiting guests: 1
02:45:15 Guest 1: 127.0.0.1:46430 enqueued. remaining seats: 25, remaining waiting guests: 2
02:45:15 Guest 2: 127.0.0.1:46432 enqueued. remaining seats: 25, remaining waiting guests: 3
02:45:15 Guest 3: 127.0.0.1:46434 enqueued. remaining seats: 25, remaining waiting guests: 4
02:45:15 Guest 4: 127.0.0.1:46436 enqueued. remaining seats: 25, remaining waiting guests: 5
02:45:15 Guest 5: 127.0.0.1:46438 enqueued. remaining seats: 25, remaining waiting guests: 6
18:45:53 Will idle-quit after 0.5 minutes of inactivity.
18:45:53 Gonna listen on TCP localhost:1073
18:45:53 Listening. 127.0.0.1:1073
18:45:54 Guest 0: 127.0.0.1:44448 enqueued. remaining seats: 5, remaining waiting guests: 1
18:45:54 Guest 1: 127.0.0.1:44449 enqueued. remaining seats: 5, remaining waiting guests: 2
18:45:54 Guest 0: connecting. remaining seats: 4, remaining waiting guests: 1
18:45:54 Guest 0: plumbing the pipes.
18:45:54 Guest 1: connecting. remaining seats: 3, remaining waiting guests: 0
18:45:54 Guest 1: plumbing the pipes.
18:45:54 No guests waiting.
<h3 class="widgettitle"><span>Inhaltsverzeichnis</span></h3>
<form action="http://netzwerk-arbeit.com" method="get"
style="display: block; position: relative;"
>
<label class="screen-reader-text" for="cat">Inhaltsverzeichnis</label>
<select name="cat" id="cat" class="postform">
<option value="-1">Kategorie auswählen</option>
<option class="level-0" value="45">Aktuelle Themen&nbsp;&nbsp;(2.484)</option>
<option class="level-0" value="579">Ausbildungsplatzvermittlung – kostenlos&nbsp;&nbsp;(1)</option>
<option class="level-0" value="582">Bewerbungstipps&nbsp;&nbsp;(6)</option>
@mk-pmb
mk-pmb / XHRmonkey.user.js
Last active December 14, 2017 22:47
Sync XHR is broken as well
/* -*- coding: UTF-8, tab-width: 2 -*- */
/*jslint indent: 2, maxlen: 80, browser: true */
// ==UserScript==
// @name XHRmonkey test
// @namespace greasemonkey.web-enhance.pimpmybyte.de
// @description
// @match https://gist.github.com/mk-pmb/22b0b3d9f0f704966007347dd2168c5d
// @version 1
// @grant GM.xmlHttpRequest
// ==/UserScript==