Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Marchetti adamnew123456

View GitHub Profile
@adamnew123456
adamnew123456 / sane_decoder.lua
Created Mar 13, 2021
A Wireshark dissector for the SANE network protocol
View sane_decoder.lua
--[[
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
@adamnew123456
adamnew123456 / rpnjit-1.md
Created Mar 8, 2020
A Programmable RPN Calculator and JIT Compiler
View rpnjit-1.md

A Basic RPN Calculator

We're going to start with a basic RPN interpreter and add function definitions to it. That will serve as a good starting point for adding on JIT compilation later. There are only going to be a few primitives to start with:

  • Integer constants
  • Arithmetic operators: +, -, *, /, %
  • Stack manipulation: swap, dup, drop
  • Display: print
View checktask2.tcl
package require Tk
# Checktask format:
#
# %Y-%m-%d,%H:%M:%S,message
if [string equal $tcl_platform(platform) "windows"] {
set checktask_file $env(APPDATA)/checktask.csv
} else {
set checktask_file $env(HOME)/.checktask.csv
}
View dayclock.tcl
package require Tk
wm title . "Dayclock"
wm geometry . 200x225
canvas .clock
pack .clock
set expired_slice [.clock create arc 1 1 200 200 \
-start 225 -extent -270 -fill red]
@adamnew123456
adamnew123456 / elzilla.el
Last active Jun 22, 2019
A collection of utilities for checking Bugzilla from Emacs
View elzilla.el
;; Copyright 2019, Chris Marchetti
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@adamnew123456
adamnew123456 / bezier.js
Created Dec 24, 2018
A sample for generating bezier curves
View bezier.js
function interpolate(a, b, ratio) {
return ratio * (b - a) + a;
}
function Point(x, y) {
return {x: x, y: y};
}
function bezier(points, ratio) {
if (points.length < 2) return null;
@adamnew123456
adamnew123456 / totp.py
Created Nov 23, 2018
Generates 2FA Codes from TOTP URLs
View totp.py
import base64
import hmac
import struct
import sys
import time
from urllib.parse import unquote
def generate_hotp_code(secret, counter, hash_algo='sha1', size=6):
"""
Generates a HOTP code.
@adamnew123456
adamnew123456 / tctest.tcl
Last active Oct 7, 2018
Basic Tcl testing sample
View tctest.tcl
# Checks if the argument string is blank
proc is_blank {x} {
return [string equal $x {}]
}
namespace eval fixture {
namespace export create execute
namespace ensemble create
# Creates a new fixture, which contains a group of tests and an optional
View feed.el
(require 'browse-url)
(require 'helm)
(require 'seq)
(require 'url)
(defun xml-node (node)
"Returns the symbol for the node type (e.g. 'li for <li>...</li>)"
(car node))
(defun xml-attr (node attr)
View dotnotebooks.tcl
proc jdbc_command {options} {
set classpath [lindex $options 0]
set commands {/usr/bin/java -classpath}
lappend commands "/home/chris/Source/jdbcnotebook/target/server-1.0-SNAPSHOT-jar-with-dependencies.jar:$classpath"
lappend commands {*}[lrange $options 1 end]
return $commands
}