Skip to content

Instantly share code, notes, and snippets.

Avatar

Peter Krumins pkrumins

View GitHub Profile
@pkrumins
pkrumins / nylki-lindenmayer-browser.js
Created Jun 20, 2019
nylki/lindenmayer library that works in IE
View nylki-lindenmayer-browser.js
/* This is a modified version of https://github.com/nylki/lindenmayer.
** The modifications make it work in Internet Explorer again.
** The modifications include:
** * Replacing `let` with `var`.
** * Replacing `{ x }` with `{ x : x }` in object context.
** * Replacing `class` with `function.
** * Replacing `{ arg1, arg2, }` with `opts` in function definition context.
** * Replacing `x of obj` with a `for (var i = 0; i < obj.length; i++)`
** * Replacing default arguments with `if (arg === undefined) { arg = defaultVal; }`
** * Replacing `array.push(...obj)` with `array.extend(obj)`.
View coding-horror.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:f048ceb9e7e5520110da
use warnings;
use strict;
use Text::CSV;
use constant {
ID => 0,
TYPE => 1,
SOURCE => 2,
AMOUNT => 3,
View gist:d50d7e12492362fcbbf5
iptables.list('Tunnels', function (rules) {
var ports = {};
rules.forEach(function (rule) {
if (rule.parsed.target == 'REJECT') return;
// extract tcp destination ports
var match = rule.raw.match(/tcp dpt:(\d+)/);
if (match) {
ports[parseInt(match[1])] = 1;
View gist:9315876
[daemons]
; enable SSL support by uncommenting the following line and supply the PEM's below.
; the default ssl port CouchDB listens on is 6984
; httpsd = {couch_httpd, start_link, [https]}
compaction_daemon={couch_compaction_daemon, start_link, []}
[compaction_daemon]
; The delay, in seconds, between each check for which database and view indexes
; need to be compacted.
check_interval = 300
View gist:8944170
<?php
$browserlingTunnelPort = 59374;
$browserlingTunnelUrl = "http://tunnel.browserling.com:" . $browserlingTunnelPort . "/WordPress/TestingWp/";
if ($_SERVER['REMOTE_ADDR'] != '127.0.0.1') {
define('WP_SITEURL', $browserlingTunnelUrl);
define('WP_HOME', $browserlingTunnelUrl);
update_option('siteurl', $browserlingTunnelUrl);
View gist:8484697
#include <windows.h>
#include <cstdio>
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow) {
while (1) {
HWND dialog = FindWindow("MozillaDialogClass", "FireFox Update");
if (dialog) {
printf("Found dialog: %x\n", dialog);
HWND dialogItem = NULL;
SendMessage(dialog, WM_CLOSE, 0, 0);
View gist:1176472
var $ = require('jquery-browserify');
$(window).ready(function () {
if (!window.navigator.userAgent.match(/chrome|chromium/i)) {
$('<div>')
.addClass('alert')
.append(
$('<img>').attr('src', '/img/chrome.png'),
$('<div>').text(
"You don't appear to be using chrome, "
View gist:770671
// server.js
var dnode = require('dnode');
function Manager () {
var desktops = {};
var self = this;
this.spawn = function (name) {
View gist:702248
import Prelude hiding (catch)
import System (getArgs)
import System.IO (hPutStrLn, hSetBuffering, BufferMode(NoBuffering), hClose, Handle)
import System.IO.Error (isEOFError, IOError(..))
import Network (connectTo, PortID(..), withSocketsDo)
import Control.Concurrent (forkIO, threadDelay)
import Control.Exception
delay :: Int
delay = 60
You can’t perform that action at this time.