Skip to content

Instantly share code, notes, and snippets.

View splch's full-sized avatar

Spencer Churchill splch

View GitHub Profile
@splch
splch / windows_setup.ps1
Last active December 17, 2023 04:57
Windows setup script
# Check for Administrator Privileges
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Host "This script requires Administrator privileges. Please run it as an Administrator."
Exit
}
# Run as Administrator
Set-ExecutionPolicy Bypass -Scope Process -Force -Confirm:$false
# Install Chocolatey
@splch
splch / adversarial_benchmark.ipynb
Last active November 16, 2023 23:10
The notebook describes and implements an "Adversarial Error Benchmarking" process for quantum circuits, where a specific quantum circuit is designed to evaluate the error rate on a simulated quantum device, Aria-2, with a defined noise model.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
first_key_down next_key_down freq mean std
A A 75865 415.7420473683694 211.15077174990657
A B 1004970 165.28457375000784 85.53598674842621
A C 2195967 167.4397778601112 61.035602729802285
A D 1441567 162.8665241188316 31.321963905203503
A E 3605848 405.72196709898844 208.6443786776474
A F 651427 402.95098691571224 203.15117061387028
A G 638791 395.8929611390238 198.9873950522662
A H 5849734 197.66910352690073 90.16204233255728
A I 601633 249.09574362732477 202.01115726544845
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
# Start with a base Ubuntu 22.04 image
# --platform=linux/amd64
FROM ubuntu:22.04
# Set environment variables
ENV DEBIAN_FRONTEND=noninteractive \
LLVM_VERSION=c0b45fef155fbe3f17f9a6f99074682c69545488 \
LLVM_INSTALL_PATH=/opt/llvm \
CUDAQ_INSTALL_PATH=$HOME/.cudaq
@splch
splch / progress.py
Last active April 21, 2024 11:34 — forked from spava/progress.py
a simple and useful progress bar in python
import time, sys
def progress(iterable, length=33):
total, start = len(iterable), time.monotonic()
for count, it in enumerate(iterable, 1):
yield it
if count % max(1, total // 10000) == 0 or count == total:
percent = count / total
sys.stdout.write(
f'\r▕{"█" * int(length * percent) + " " * (length - int(length * percent))}▏ '
@splch
splch / isWorn.js
Created September 6, 2022 14:52
detect if a bangle watch is being worn
function isWorn() {
console.log(Bangle.isCharging(), E.getTemperature(), Bangle.getAccel().mag);
if (Bangle.isCharging())
return false;
if (E.getTemperature() >= 33.1)
// https://www.ncbi.nlm.nih.gov/pmc/articles/PMC8266026/table/T2/
return true;
if (Bangle.getAccel().mag >= 1.02)
return true;
return false;
@splch
splch / LICENSE
Created April 27, 2022 13:26
This license applies to every gist I create, unless otherwise stated.
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
@splch
splch / readability.css
Last active November 29, 2022 23:04
CSS rules optimized for site readability
:root {
--bg-color: #ffffff;
--font-color: #000000;
/* highest contrast colors
for light and dark themes */
--red: #ec0000;
--green: #008900;
--blue: #5f5fff;
--gray: #757575;
}