Skip to content

Instantly share code, notes, and snippets.

View constructor-s's full-sized avatar

Bill constructor-s

View GitHub Profile
@constructor-s
constructor-s / README.md
Created February 14, 2023 16:35
Rule of Three Substitution

Build and run instructions:

>javac Substitution.java

>java Substitution < input.txt
Rules:
AA AB
AB BB
inkscape %1 --export-filename %1.emf
pause
@constructor-s
constructor-s / ping_until_success_and_echo_bell.bat
Created May 22, 2022 14:12
A bat script to keep pinging a target until success and echo the BELL character
@echo off
:repeat
ping 1.1.1.1 -n 1 || goto :repeat
echo Success!
echo 
pause
javascript:window.location.href="https://myaccess.library.utoronto.ca/login?url=" + window.location.href;
; RDP Wrapper Library configuration
; Do not modify without special knowledge
[Main]
Updated=2019-08-03
LogFile=\rdplog.txt
SLPolicyHookNT60=1
SLPolicyHookNT61=1
@constructor-s
constructor-s / mpl_deserialize.bat
Last active May 29, 2021 04:33
Quick preview and export of Matplotlib Figure pickles
call conda activate
python mpl_deserialize.py %1 --preview
@constructor-s
constructor-s / option.py
Last active April 12, 2021 00:33
Black Scholes Merton option with only Python standard library (Work in progress)
from math import sqrt, erf, pi, exp, log
N = lambda x: (1.0 + erf(x / sqrt(2.0))) / 2.0
phi = lambda x: exp(-0.5*x*x)/sqrt(2.0*pi)
class Option:
def __init__(self, St, K, t, s, r=0, q=0):
self.St = St # 0.90
self.K = K # 1.00
self.s = s # 0.20
@constructor-s
constructor-s / linear_regression_p_value.ipynb
Last active February 17, 2021 03:56
Linear_Regression_P_Value.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@constructor-s
constructor-s / float_bits.py
Created October 17, 2020 19:56
See the representation of a floating point in Python
import struct
num = 0.5
bits = [[c>>i & 1 for i in range(7, -1, -1)] for c in struct.pack("!d", num)]
bits_flatten = [i for l in bits for i in l]
bits_sign = bits_flatten[0]
bits_exponent = bits_flatten[1:12]
bits_fraction = bits_flatten[12:64]
@constructor-s
constructor-s / HtmlToPDF.java
Last active January 18, 2022 00:37
Visual Field CSS Pattern Test
package com.example;
import com.itextpdf.html2pdf.HtmlConverter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
/**