Skip to content

Instantly share code, notes, and snippets.

View adamnew123456's full-sized avatar

Chris Marchetti adamnew123456

  • Chapel Hill, NC
View GitHub Profile
@adamnew123456
adamnew123456 / sane_decoder.lua
Created March 13, 2021 21:20
A Wireshark dissector for the SANE network protocol
--[[
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 March 8, 2020 21:53
A Programmable RPN Calculator and JIT Compiler

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
@adamnew123456
adamnew123456 / checktask2.tcl
Last active February 28, 2020 02:15
Task Checker
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
}
@adamnew123456
adamnew123456 / dayclock.tcl
Created February 15, 2020 05:39
Day Clock
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 June 22, 2019 22:21
A collection of utilities for checking Bugzilla from Emacs
;; 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 December 24, 2018 02:49
A sample for generating bezier curves
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 November 23, 2018 17:54
Generates 2FA Codes from TOTP URLs
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 October 7, 2018 17:00
Basic Tcl testing sample
# 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
@adamnew123456
adamnew123456 / feed.el
Created July 2, 2018 12:08
Elisp Scripts
(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)
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
}