Skip to content

Instantly share code, notes, and snippets.

Avatar

Matthew Hayter matthayter

View GitHub Profile
@matthayter
matthayter / pync.py
Created Mar 27, 2020
Eventually planned to be a decent netcat replacement for windows.
View pync.py
import asyncio
import sys
import socket
import signal
signal.signal(signal.SIGINT, signal.SIG_DFL)
from argparse import ArgumentParser
def parse_cl():
@matthayter
matthayter / capslock.ahk
Last active Aug 1, 2017
Autohotkey: Use Caps Lock as both CTRL and Escape: Hold for CTRL; tap for Escape.
View capslock.ahk
SetCapsLockState Off
*CapsLock::
key=
Input, key, B C L1 T1, {Esc}
if (ErrorLevel = "Max")
if key {
Send {Ctrl Down}
Send {Blind}%key%
}
@matthayter
matthayter / monty_hall.js
Created Feb 17, 2016
A demonstration of the Monty Hall problem.
View monty_hall.js
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min)) + min;
}
var monty = function(doSwitch) {
var tryCount = 10000;
var winCount = 0.0;
for (var i = 0; i < tryCount; i++) {
var car = getRandomInt(0, 3);
View Sudoku
import Data.Matrix
import Data.Maybe
import Data.List
import Data.Char
import Control.Monad
import qualified Data.Vector
type Puzzle = Matrix (Maybe Int)
puzzle = puzzleFromLines
@matthayter
matthayter / curl-format.txt
Created Jul 23, 2014
Curl timing-info config: To be run with curl -w "@curl-format.txt" -o /dev/null -s http://...
View curl-format.txt
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
\n
You can’t perform that action at this time.