Skip to content

Instantly share code, notes, and snippets.

View cwarden's full-sized avatar

Christian G. Warden cwarden

View GitHub Profile
require "try-catch"
try {
function()
error('oops')
end,
catch {
function(error)
print('caught error: ' .. error)
@cwarden
cwarden / taxes.smt2
Created September 19, 2022 12:41 — forked from lynaghk/taxes.smt2
S-Corp tax optimization with the Z3 Theorem Prover
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Solo freelancer's S-Corp tax optimization
;;
;; Assumes an unmarried single-shareholder and tons of other stuff.
;; I'm not a tax professional, no guarantees here, probably typos, etc. Come on!
;; Run with https://github.com/Z3Prover/z3
;;
;; See also my notes at https://kevinlynagh.com/financial-plan/
@cwarden
cwarden / build-pentaho-debs.sh
Created December 2, 2011 02:25
Create Pentaho BI Server Debian Package Using fpm
fpm --maintainer 'Christian G. Warden <cwarden@xerus.org>' \
--description 'Pentaho BI Server Community Edition' \
--url http://community.pentaho.com/projects/bi_platform/ \
--depends java6-runtime \
--name pentaho-bi-server \
--version 3.10.0 \
--architecture all \
--exclude /opt/pentaho/biserver-ce/pentaho-solutions/system/saiku \
-s dir -t deb \
/opt/pentaho/biserver-ce
@cwarden
cwarden / Misc.pm.patch
Created February 22, 2012 01:04
logitech media server fix for git annex
--- /usr/share/perl5/Slim/Utils/Misc.pm
+++ /usr/share/perl5/Slim/Utils/Misc.pm
@@ -857,7 +857,9 @@
$target = ($target =~ /^\// ? $target : catdir($dirname, $target));
if (-f $target) {
- return 0 if $target !~ $validRE;
+ # ignore the extension for symlinks. allows use of git annex repos
+ # cwarden@xerus.org - 2012-02-06
+ # return 0 if $target !~ $validRE;
@cwarden
cwarden / EXAMPLE
Created September 18, 2011 19:24
MySQL-Proxy Mock Server/JDBC Bug
$ javac MysqlProxyTest.java
$ mysql-proxy --plugins=proxy --proxy-lua-script="$(pwd)/mock-server.lua" --proxy-address 127.0.0.1:4040 --daemon
$ java -cp .:./mysql-connector-java-5.1.17-bin.jar MysqlProxyTest
Cannot connect to database server:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
The last packet successfully received from the server was 41 milliseconds ago. The last packet sent successfully to the server was 11 milliseconds ago.
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
@cwarden
cwarden / NPI Importer.go
Created September 13, 2017 16:44 — forked from ewhitebloom/NPI Importer.go
ETL NPI data from NPI CSV file to MySQL.
package main
import (
"bufio"
"database/sql"
"fmt"
_ "github.com/go-sql-driver/mysql"
"os"
"reflect"
"strconv"
@cwarden
cwarden / stdin2www.sh
Created March 7, 2011 21:54
Show stdin in a web browser
#!/bin/sh
# read from stdin, write to a temp file, open the temp file in a browser, then delete it
tmpfile=$(tempfile); cat > $tmpfile; x-www-browser $tmpfile; rm $tmpfile
@cwarden
cwarden / config.json
Last active February 16, 2016 04:13 — forked from anonymous/config.json
Bootstrap Customizer Config
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "darken(#428bca, 6.5%)",
"@brand-success": "#5cb85c",
@cwarden
cwarden / Toogle New Components
Last active December 22, 2015 04:19
A bookmarklet to toggle between all components and new components in Salesforce's packaging page. Visit http://jsfiddle.net/cwarden/Vzm2s/embedded/result/ for link to drag to bookmark bar.
javascript:(function(e,a,g,h,f,c,b,d){if(!(f=e.jQuery)||g>f.fn.jquery||h(f)){c=a.createElement("script");c.type="text/javascript";c.src="//ajax.googleapis.com/ajax/libs/jquery/"+g+"/jquery.min.js";c.onload=c.onreadystatechange=function(){if(!b&&(!(d=this.readyState)||d=="loaded"||d=="complete")){h((f=e.jQuery).noConflict(1),b=1);f(c).remove()}};a.documentElement.childNodes[0].appendChild(c)}})(window,document,"1.8.3",function($,L){(function() { if ($('.dataRow:hidden').length) { $('.dataRow').show(); } else { $('.dataRow').hide(); $('.dataRow td:nth-child(7):empty').add('.dataRow td:nth-child(7):contains("N/A")').parent(':has(td:nth-child(8):empty)').show(); }})()});
@cwarden
cwarden / debounce.js
Last active December 19, 2015 23:29 — forked from swannodette/debounce.clj
/* Takes a function that optionally returns a promise, and debounces it, returning a
* promise to all callers. When the debounced function fulfills its promise or
* returns a non-promise, all callers get the result.
* Example: http://bit.ly/1btZC4f
*/
var debounce = function(func, wait, immediate) {
var timeout;
var deferred = $.Deferred();
return function() {
var context = this, args = arguments;