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 / 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
}
@adamnew123456
adamnew123456 / shader.glsl
Created February 20, 2017 02:05
Ghost Shader
vec4 colorAt(in vec2 coord, in int channel) {
if (channel == 0) return texture2D(iChannel0, coord.xy / iChannelResolution[0].xy);
if (channel == 1) return texture2D(iChannel1, coord.xy / iChannelResolution[1].xy);
if (channel == 2) return texture2D(iChannel2, coord.xy / iChannelResolution[2].xy);
if (channel == 3) return texture2D(iChannel3, coord.xy / iChannelResolution[3].xy);
}
float monochrome(in vec4 color) {
return (color.r + color.g + color.b) / 3.0;
}
@adamnew123456
adamnew123456 / scan.py
Last active December 29, 2017 09:33
Scan Images From HP 3050A Printer/Scanner
"""
Interfacing with the HP 3050A to automate scanning.
Copyright (c) 2014, Adam Marchetti
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
@adamnew123456
adamnew123456 / ledger.R
Created September 2, 2017 22:14
Basic analysis of ledger files
#!/usr/bin/Rscript
printf <- function(fmt, ...) cat(sprintf(fmt, ...))
# Reads a Ledger file by doing CSV export on the CLI, and then slurping
# it into R's CSV reader.
#
# start and end can be used to limit which entries are allowed in by time,
# and accounts can be used to limit which accounts are read.
ledger.read <- function(filename,
start=NA,
@adamnew123456
adamnew123456 / xslt.cs
Created March 29, 2017 14:30
XSN XSLT
using System;
using System.IO;
using System.Xml;
using System.Xml.Xsl;
namespace XSLTEvaluator
{
public class MainClass
{
public static void Main(string[] Args)