Skip to content

Instantly share code, notes, and snippets.

View bmatzelle's full-sized avatar

Brent Matzelle bmatzelle

View GitHub Profile
@bmatzelle
bmatzelle / python_django_template_example.html
Created December 17, 2014 16:51
Python Django template example
<html>
<head>
<link href="https://ssl.vuzit.com/stylesheets/Vuzit-2.10.css" rel="Stylesheet" type="text/css" />
<script src="https://ssl.vuzit.com/javascripts/Vuzit-2.10.js" type="text/javascript"></script>
<script type="text/javascript">
// Called when the page is loaded.
function initialize() {
vuzit.Base.apiKeySet("{{public_key}}");
var options = {signature: '{{signature}}',
@bmatzelle
bmatzelle / vuzit_django_signature_example.py
Last active August 29, 2015 14:11
Python Django Vuzit signature example
import time
import sha
import hmac
import base64
# Add your client settings here
public_key = '<YOUR PUBLIC KEY>'
private_key = '<YOUR PRIVATE KEY>'
# View a document
@bmatzelle
bmatzelle / SQL_Server_List_All_Foreign_Keys.sql
Created April 1, 2014 00:51
Lists all foreign keys in an MS SQL Server database
-- Lists all foreign keys in an MS SQL Server database
-- Grabbed from here:
-- http://lostechies.com/jimmybogard/2008/11/27/viewing-all-foreign-key-constraints-in-sql-server/
SELECT
f.name AS ForeignKey,
OBJECT_NAME(f.parent_object_id) AS TableName,
COL_NAME(fc.parent_object_id, fc.parent_column_id) AS ColumnName,
OBJECT_NAME (f.referenced_object_id) AS ReferenceTableName,
COL_NAME(fc.referenced_object_id, fc.referenced_column_id) AS ReferenceColumnName
FROM
@bmatzelle
bmatzelle / Sql_Server_backup_to_disk.sql
Created February 19, 2014 16:38
Example of how to backup a table with SQL for SQL Server
DECLARE @dbName varchar(1000);
DECLARE @exportPath varchar(1000);
SET @exportPath = 'C:\Database_Backups';
SET @dbName = 'YourDatabase';
-- Backs up data in the format: "[DB_name]_YYYY.MM.DD.bak"
SET @exportPath = @exportPath + '\' + @dbName + '_' +
(SELECT CONVERT(VARCHAR(12), GETDATE(), 102)) + '.bak';
Folder PATH listing
Volume serial number is E00C-A166
C:\PROGRAM FILES (X86)\GIT
| Git Bash.lnk
| Git Bash.vbs
| ReleaseNotes.rtf
| unins000.dat
| unins000.exe
|
+---bin
@bmatzelle
bmatzelle / routing_number_check_sum.rb
Created May 2, 2013 14:13
Ruby routing number check sum function
# Ruby routing number check sum function. Code adapted from Wikipedia Python
# example: http://en.wikipedia.org/wiki/Routing_transit_number
# Returns true if a routing number string check sum is valid.
def routing_number_check_sum(number)
d = []
number.each_char { |char| d << char.to_i }
d[8] == (7 * (d[0] + d[3] + d[6]) +
3 * (d[1] + d[4] + d[7]) +
@bmatzelle
bmatzelle / Nini_Write_File.cs
Created February 22, 2012 01:11
Writes an INI file using Nini
/*
Shows an example of Nini's IniDocument class to write an INI file. The example below
will write the following INI file "configuration.ini":
[Cars]
model = Toyota
year = 2012
*/
Nini.Ini.IniDocument doc = new Nini.Ini.IniDocument();
@bmatzelle
bmatzelle / gist:1880345
Created February 22, 2012 01:07
Reading INI file with Nini
/*
Shows an example of Nini's IniDocument class to read an INI file.
Example configuration.ini file:
[Cars]
model = Toyota
year = 2012
*/
@bmatzelle
bmatzelle / gist:245561
Created November 30, 2009 17:12
Vuzit on page changed example
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Vuzit onPageChanged Example</title>
<link href="http://vuzit.com/stylesheets/Vuzit-2.9.css" rel="Stylesheet" type="text/css" />
<script src="http://vuzit.com/javascripts/Vuzit-2.9.js" type="text/javascript"></script>
@bmatzelle
bmatzelle / FogBugz 7 MySQL Export Primary Key and Index Fix Script.sql
Created November 18, 2009 18:13
Fixes teh FogBugz 7 MySQL primary key export
-- FogBugz 7 MySQL Export Primary Key and Index Fix Script
--
-- The FogBugz 7 MySQL data export does not create a database with the primary
-- keys created. When the export is imported and you run FogBugz you will
-- see an error like the one below on FogBugz:
--
-- Dynamic SQL generation for the UpdateCommand is not supported against
-- a SelectCommand that does not return any key column information
--
-- Running the script below creates the necessary primary keys and also removes