Skip to content

Instantly share code, notes, and snippets.

View deckar01's full-sized avatar

Jared Deckard deckar01

View GitHub Profile
@deckar01
deckar01 / prusa_notify.py
Last active May 27, 2024 17:33
Send push notifications when a Prusa printer needs attention
import datetime
import requests
import time
from tqdm import tqdm
class PrintMonitor:
# !!! ADD CONFIGURATION !!! #
# See https://help.prusa3d.com/guide/wi-fi-and-prusalink-setup-xl-firmware-up-to-4-7-5_419630
@deckar01
deckar01 / github-dark-colorblind-zen.css
Last active October 30, 2021 21:52
GitHub Dark Colorblind Zen
.blob-code-hunk {
/* background-color: var(--color-accent-subtle); */
border: 1px solid var(--color-btn-bg);
}
.blob-num-hunk, .blob-num-expandable {
/* background-color: var(--color-accent-muted); */
background-color: var(--color-btn-bg);
}
@deckar01
deckar01 / mono-tri-sim-anneal.cu
Created September 23, 2021 18:08
[AZSPCS] Monochromatic Triangles: CUDA Simulated Annealing
#include <iostream>
#include <iomanip>
#include <math.h>
#include <curand.h>
#include <curand_kernel.h>
#define M (N * (N - 1) / 2)
#define index (blockDim.x * blockIdx.x + threadIdx.x)
#define offset (M * index)
#define roll(n) (curand(&rng[index]) % (n))
import os
import cProfile
from marshmallow import Schema
BRANCH = os.popen('git rev-parse --abbrev-ref HEAD').read().strip()
values = (1, True, '3')
class ImplicitSchema(Schema):
class Meta:
@deckar01
deckar01 / bricks.scad
Created July 24, 2018 22:27
OpenSCAD Bricks Benchmark
INCHES = 25.4;
brick_depth = (3 + 5/8) * INCHES;
brick_height = (2 + 1/4) * INCHES;
brick_length = (7 + 5/8) * INCHES;
mortar_gap = (3/8) * INCHES;
module Brick() {
cube([brick_length, brick_depth, brick_height]);
diff --git a/benchmarks/run.py b/benchmarks/run.py
index c1209e9..9f5681f 100644
--- a/benchmarks/run.py
+++ b/benchmarks/run.py
@@ -15,6 +15,7 @@ from pathlib import Path
from statistics import StatisticsError, mean
from statistics import stdev as stdev_
+from test_marsha import TestMarsha
from test_pydantic import TestPydantic
@deckar01
deckar01 / promiseMatchers.js
Last active March 7, 2016 22:02
Working replacement of promise-matchers for jasmine 2
beforeEach(function () {
jasmine.addMatchers({
toHaveBeenResolved: function() {
return {
compare: function(promise) {
promise
.thenCatch(function() {
expect('promise').toBe('resolved');
});
@deckar01
deckar01 / promiseMatchers.js
Last active March 7, 2016 22:00
Failed attempt at promise matchers wrapper for jasmine 2
beforeEach(function () {
jasmine.Matchers = {prototype: {}};
jasmine.Env = {prototype: {}};
require('promise-matchers');
Object.keys(jasmine.Matchers.prototype).forEach(function(key) {
var matcher = jasmine.Matchers.prototype[key];
jasmine.Matchers.prototype[key] = function() {
return {
compare: function(actual, done, expected) {
@deckar01
deckar01 / selenium-webdriver-2.48.2_firefox-43.0_debug
Last active January 6, 2016 17:19
Debugging issues with selenium-webdriver-2.48.2 and firefox-43.0 on Linux
10:05:47.619 INFO - Executing: [new session: Capabilities [{browserName=firefox}]])
10:05:47.620 INFO - Creating a new session for Capabilities [{browserName=firefox}]
org.openqa.selenium.firefox.NotConnectedException: Unable to connect to host localhost.localdomain on port 7055 after 45000 ms. Firefox console output:
Xlib: extension "RANDR" missing on display ":99".
process 6144: D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/var/lib/dbus/machine-id": No such file or directory
See the manual page for dbus-uuidgen to correct this issue.
D-Bus not built with -rdynamic so unable to print a backtrace
Redirecting call to abort() to mozalloc_abort
@deckar01
deckar01 / gist:beb96fc0afc0715f01bb
Created July 16, 2015 20:43
Two Buckets One Tap
function Bucket(capacity, level){
this.capacity = capacity;
this.level = level || 0;
}
Bucket.prototype.fill = function(){
this.level = this.capacity;
}
Bucket.prototype.discard = function(){
this.level = 0;
}