Skip to content

Instantly share code, notes, and snippets.

View elliott-beach's full-sized avatar

Elliott Beach elliott-beach

  • Epic
  • Minnesota
View GitHub Profile
@elliott-beach
elliott-beach / Installit.ps1
Last active June 23, 2023 15:05
Install Visual Studio Code with Powershell
$ProgressPreference = 'SilentlyContinue'
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
Invoke-WebRequest "https://update.code.visualstudio.com/latest/win32-x64-user/stable" -OutFile $env:Temp/codesetup.exe;
Invoke-Expression "$env:Temp/codesetup.exe /VERYSILENT /mergetasks=!runcode";
@elliott-beach
elliott-beach / solver.py
Last active May 14, 2022 05:24
Solving SEND+MORE=MONEY rapidly using backtracking search
# Solves the SEND + MORE = MONEY letter substituion puzzle as a constraint satisfaction problem using backtracking search,
# searching variables (letters) in the least constrained ordering and values (digits) in the most constrained ordering,
# making the algorithm thousands of times faster.
from pprint import pprint
s1 = 'send'
s2 = 'more'
s3 = 'money'
@elliott-beach
elliott-beach / heap.py
Created February 8, 2017 15:28 — forked from showell/heap.py
heapsort in Python
def swap(a, i, j):
a[i], a[j] = a[j], a[i]
def is_heap(a):
n = 0
m = 0
while True:
for i in [0, 1]:
m += 1
if m >= len(a):
@elliott-beach
elliott-beach / FiddlerScriptDesktopNotfication.js
Last active April 30, 2019 12:54
Show a desktop notification from FiddlerScript
private function ShowPopup(message:String)
{
const notification = new System.Windows.Forms.NotifyIcon();
notification.Visible = true;
var icon = System.Drawing.SystemIcons.Information;
notification.Icon = icon;
notification.BalloonTipText = message;
const durationDisplayedInSeconds = 4;
@elliott-beach
elliott-beach / setjmp.c
Created October 12, 2017 20:10
Comments on setjmp
#include <stdio.h>
#include <setjmp.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>
#define SECOND 1000000
#define STACK_SIZE 4096
ERROR: (no-implicit-dependencies) src/client/banner.ts[4, 24]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-implicit-dependencies) src/client/extension.ts[10, 25]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-implicit-dependencies) src/client/extension.ts[11, 60]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-duplicate-imports) src/client/extension.ts[11, 1]: Multiple imports from 'vscode' can be combined into one.
ERROR: (no-duplicate-imports) src/client/extension.ts[14, 1]: Multiple imports from './common/configSettings' can be combined into one.
ERROR: (no-unnecessary-type-assertion) src/client/extension.ts[131, 47]: This assertion is unnecessary since it does not change the type of the expression.
ERROR: (no-implicit-dependencies) src/client/sortImports.ts[2, 25]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-unnecessary-type-assertion) src/client/sortImports.ts[36, 29]: This assertion is unnecessary sinc
ERROR: (no-implicit-dependencies) src/client/banner.ts[4, 24]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-implicit-dependencies) src/client/extension.ts[10, 25]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-implicit-dependencies) src/client/extension.ts[11, 60]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-duplicate-imports) src/client/extension.ts[11, 1]: Multiple imports from 'vscode' can be combined into one.
ERROR: (no-duplicate-imports) src/client/extension.ts[14, 1]: Multiple imports from './common/configSettings' can be combined into one.
ERROR: (no-unnecessary-type-assertion) src/client/extension.ts[131, 47]: This assertion is unnecessary since it does not change the type of the expression.
ERROR: (no-implicit-dependencies) src/client/sortImports.ts[2, 25]: Module 'vscode' is not listed as dependency in package.json
ERROR: (no-unnecessary-type-assertion) src/client/sortImports.ts[36, 29]: This assertion is unnecessary sinc
#!/bin/python3
import sys
def left(x):
return 2*x + 1
def right(x):
return 2*x + 2
@elliott-beach
elliott-beach / classtest.py
Last active December 30, 2017 03:33
How to resolve the error for mypy #4335
from typing import Any, Dict, Optional, Sequence, Tuple
class BaseClass(object):
def __init__(self, foo: str, *args: Any, **kwargs: Any) -> None:
self.foo = foo
super().__init__(*args, **kwargs)
class Mixin(object):
def __init__(self, bar: str, baz: Optional[str]=None, *args: Any, **kwargs: Any) -> None:
self.bar = bar
⋊> ~/m/p/project3 on master ⨯ gs 20:54:28
## master...origin/master
M Kernel.cc
M Kernel.h
?? .vscode/
?? cmake-build-debug/
?? filesys.dat
?? fsck.cc
?? ln
⋊> ~/m/p/project3 on master ⨯ git sync 20:55:06