Skip to content

Instantly share code, notes, and snippets.

View MichaelPaulukonis's full-sized avatar

Michael Paulukonis MichaelPaulukonis

View GitHub Profile
@MichaelPaulukonis
MichaelPaulukonis / r0t.pde
Last active August 29, 2015 13:56
Processing MOOC week 2
// https://class.coursera.org/compartsprocessing-001/human_grading/view/courses/972068/assessments/3/submissions
//
// In this assignment, you must produce an original sketch containing at least 20 distinct objects of at least 2 kinds of shapes.
// Each object must be unique, in shape (ellipse, rect, etc), or in color, or in size.
// Although shapes must be visible on your canvas, you may include objects which are partially out of view.
// Additionally, you must include a 2 sentence (minimum) description of your artistic intent/goal for your assignment.
// This sketch contains two areas painted with rectangles of technically
// identical colors and transparency, but diminishing size, such that
// subsequent applications build from a dark tint of the background, to a
@MichaelPaulukonis
MichaelPaulukonis / restore.from.bak.sql
Last active August 29, 2015 13:56
semi-automated script to restore a SQL Server (2008/2012) database from a .bak file
-- Michael Paulukonis 2014
-- notes @ http://www.xradiograph.com/Programming/SQL
-- adapted from http://sqlanywhere.blogspot.com/2011/06/installing-sql-server-database-from-bak.html
-- ASSUMES the BAK file and dest db have the same names
-- step2 needs to pull the logical names out of the .bak file
-- original version scripted a DROP of existing table
-- I've removed it from here, in order to force a manual backup-vs-delete decision
@MichaelPaulukonis
MichaelPaulukonis / polychromatic.text.pde
Last active August 29, 2015 13:56
painting with text
/* Traditionally, text and image are segregated in Western Art.
This sketch plays with those boundaries, providing an polychromatic
text painting environment.
Mouse click and drag to paint (previous paints will fade slightly).
Color and size are based on mouse position.
Space to paint without fading previous actions.
RIGHT/LEFT to increase/decrease rotation of letters.
R to reset rotation to 0.
UP/DOWN to change paint mode.
@MichaelPaulukonis
MichaelPaulukonis / StaticLogger.cs
Last active August 29, 2015 13:59
Example of a static class for log4net; adapted from code found at http://stackoverflow.com/a/2853111/41153. Also using optional error-number (GUID) return to hide runtime errors from users.
using System.Runtime.CompilerServices;
using System.Diagnostics;
using log4net;
// TODO: you must move the below configuration call.
// It must be executed prior to any calls to Logger
// Application_Start or summat
log4net.Config.XmlConfigurator.Configure();
public class CustomError
@MichaelPaulukonis
MichaelPaulukonis / csv.export.ps1
Created June 3, 2014 17:41
Exports table data and headers as CSV file
$ErrorActionPreference="Stop"
if ($args.Count -le 2)
{
throw "Usage: <server name> <db name> <script file>"
}
$servername = $args[0]
$database = $args[1]
$sourcefile = $args[2]
@MichaelPaulukonis
MichaelPaulukonis / getFormattedDate.js
Created July 16, 2014 03:18
padded, formatted date fragment
var getDateFormatted = function() {
var d = new Date();
var df = d.getFullYear() + '.' + pad((d.getMonth() + 1), 2) + '.' + pad(d.getDate(), 2);
return df;
};
var pad = function(nbr, width, fill) {
fill = fill || '0';
nbr = nbr + '';
return nbr.length >= width ? nbr : new Array(width - nbr.length + 1).join(fill) + nbr;
@MichaelPaulukonis
MichaelPaulukonis / copy.setup.ps1
Created August 5, 2014 15:39
copy docx files for testing
$sourceDir = "\\path\to\source\"
$destDir = "\\path\to\dest\"
# NOTE: this WILL overwrite existing docs (unless open)
Copy-Item $sourceDir*.docx $destDir
# delete (hidden, leftover) office temp files
# usually caused by killing processes
Remove-Item ~*.docx -force
@MichaelPaulukonis
MichaelPaulukonis / HookHandlers.vb
Created August 14, 2014 13:35
CopyPaste Hooks from some deleted code
#Region "KeyboardHooks"
' mix of code found @
' http://stackoverflow.com/a/10257266/41153
' http://stackoverflow.com/questions/8120199/how-to-get-the-keypress-event-from-a-word-2010-addin-developed-in-c
Friend Class KeyboardHooking
' Methods
<DllImport("user32.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Shared Function CallNextHookEx(ByVal hhk As IntPtr, ByVal nCode As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr) As IntPtr
End Function
@MichaelPaulukonis
MichaelPaulukonis / dired.bat
Created September 12, 2014 13:10
Windows batchfile to open current directory in Emacs' dired
:: open current directory in dired
:: based on code from http://datko.net/2013/07/11/open-emacs-dired-buffer-from-dired/
:: save as "dired.bat" and save somewhere in PATH
:: run "dired" from command-line to open current directory in emacs w/ dired
emacsclient -e "(dired \"\")"
@MichaelPaulukonis
MichaelPaulukonis / openinemacs.bat
Created November 6, 2014 17:44
Windows batchfile to open file with emacsclient
:: open file in emacs
:: based on code from http://datko.net/2013/07/11/open-emacs-dired-buffer-from-dired/
:: save as "em.bat" and save somewhere in PATH
:: run "em foo.bar" from command-line to open foo.bar in emacs
emacsclientw -n %1