Skip to content

Instantly share code, notes, and snippets.

View idreplacer.go
package config
import (
"net/http"
"regexp"
"strings"
)
// idPatterns describes patterns of IDs in URLs. These patterns are matched
// against an entire URL. These patterns are used as given without any
View DisconnectTest.java
import java.io.IOException;
import java.io.InputStream;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
public class DisconnectTest
{
private static final int SLEEP_AFTER_DISCONNECT = 2_000;
public static void main(String[] args) throws Exception
View comment-suppressor.php
<?php
/**
* Plugin Name: Comment Suppressor
* Description: Hide comments for anonymous and “Subscriber” users.
* Version: 1.0.1
* Author: Samuel Coleman <samuel@seenet.ca>
* License: WTFPLv2
*/
View Space Engineers setup.sh
#! /bin/sh
# Configure an Ubuntu system for running Space Engineers. Flagrantly untested.
# Seriously, I haven't even run this once.
# TODO: Report progress to the web UI.
# TODO: Error checking/early failure.
# User data should contain:
#
@MrDOS
MrDOS / modifyValidatorValue.js
Created Jul 25, 2019
The Daily WTF: Break my Validation
View modifyValidatorValue.js
modifyValidatorValue: function (fieldName, validatorKey, key, value) {
if (helper.isNullOrUndefined(fieldName)
|| helper.isNullOrUndefined(validatorKey)
|| helper.isNullOrUndefined(key)
|| helper.isNullOrUndefined(value)) {
return;
}
// Iterate over fields
var field;
View mock.awk
# In retaliation to https://blog.theodo.fr/2018/03/regex-warrior/.
#
# Usage:
#
# awk -v FS=';' -v OFS=';' -f mock.awk <mock.csv
# “NR” is the number of the record we're operating on; effectively a sequential
# counter. We don't want to filter on the first row, which is the header.
NR > 1 && $7 == "false" {
next;
View whatpulse-equivs
Package: whatpulse
Section: misc
Priority: optional
Homepage: https://whatpulse.org/
Standards-Version: 3.9.2
Depends: libqtcore4, libqtwebkit4, libqt4-sql, libqt4-sql-sqlite, libqt4-script,
libssl1.0-dev, libpcap0.8, gksu
Description: Dummy package for WhatPulse dependencies.
@MrDOS
MrDOS / packcode.cpp
Last active May 2, 2017
NetBurner packcode
View packcode.cpp
/******************************************************************************
* Copyright 2005
* NetBurner, Inc.
* 5405 Morehouse Drive, Ste 200
* San Diego, CA 92121
*
* information available at: http://www.netburner.com
*
* In addition to the rights retained by the authors, you may also use
* this code under the terms of the GNU public license.
View simple-wc.c
#include <stdio.h>
#include <fcntl.h>
#include <err.h>
#include <unistd.h>
#include <inttypes.h>
#define BUF_SIZE (1048576 * 10)
int main(int argc, char *argv[])
{
@MrDOS
MrDOS / csv-good.csv
Last active Feb 3, 2017
CSV Export is Awful in Excel for Mac 2016
View csv-good.csv
Col 1 Col 2
Let's call this "1" I don't believe you
2 This field contains a newline
3, alright Sacré bleu!