Skip to content

Instantly share code, notes, and snippets.

@dmorrison42
dmorrison42 / twelveterm.py
Created March 26, 2020 00:41
Twelve Term Solution
#!/usr/bin/env python
# There are a few logical leaps here that should be documented in a writeup
# In the mean time this is a simple proof that needs some verification
from sympy import Eq, symbols, solve
from itertools import combinations
from numpy import choose
s11, s21, s12, s22 = symbols('s11 s21 s12 s22')
c11, c21, c12, c22 = symbols('c11 c21 c12 c22')
<script>
!(function () {
const url = 'http://192.168.1.41:8060';
function keypress(button) {
const httpRequest = new XMLHttpRequest();
httpRequest.open('POST', url + '/keypress/' + button, true);
httpRequest.send();
}
window.keypress = keypress;
@dmorrison42
dmorrison42 / auto-persist.js
Last active November 18, 2018 13:46
Quick and dirty persistence in Vue (for development with LiveServer)
/* Usage: Import after Vue but before `new Vue`
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script src="auto-persist.js"></script>
...
<script src="script.js"></script>
*/
Vue.use({
install(Vue) {
const storageName = 'storage';
let restored = false;
@dmorrison42
dmorrison42 / split.py
Last active May 4, 2022 08:19
Podcast Splitting Script
#!/usr/bin/env python
# Dependencies:
# ffmpeg: https://www.ffmpeg.org/download.html
# fpcalc: https://acoustid.org/chromaprint
from datetime import datetime
import os
import os.path
import json
import math
import shutil
@dmorrison42
dmorrison42 / form1.cs
Created March 14, 2017 15:39
Error handling
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Dynamic;
using System.Globalization;
using System.Linq;
using System.Runtime.ExceptionServices;
using System.Text;
@dmorrison42
dmorrison42 / keybase.md
Created February 11, 2017 11:18
Keybase IO Proof

Keybase proof

I hereby claim:

  • I am dmorrison42 on github.
  • I am dmorrison42 (https://keybase.io/dmorrison42) on keybase.
  • I have a public key ASC5-Et1PU1_wdES1YxHy-Mt4uEVZ3YY_sSFkgNMJPgSjQo

To claim this, I am signing this object:

@dmorrison42
dmorrison42 / capture.cs
Created December 17, 2016 17:53
Capture a hidden dialog c#
private async void button1_Click(object sender, EventArgs e)
{
await Task.Delay(1000);
await Task.Run(() =>
{
var fileName = @"C:\Users\dan\Desktop\Folder\bitmap.png";
var subwindow = new Slave();
subwindow.ShowInTaskbar = false;
subwindow.Show();
subwindow.DesktopLocation = new Point(int.MinValue, int.MinValue);