Skip to content

Instantly share code, notes, and snippets.

View Codesleuth's full-sized avatar

David Wood Codesleuth

View GitHub Profile
@Codesleuth
Codesleuth / hasher.js
Last active February 28, 2018 09:48
Trello Challenge
module.exports = {
hash: function (s) {
var h = 7;
var letters = "acdegilmnoprstuw";
for (var i = 0; i < s.length; i++) {
h = h * 37 + letters.indexOf(s[i]);
}
return h;
},
@Codesleuth
Codesleuth / Preferences.sublime-settings
Last active August 29, 2015 14:22
Sublime Text Settings
{
"font_size": 11,
"index_exclude_patterns":
[
"**\\node_modules*",
"*.log"
],
"phoenix_color_green": true,
"phoenix_sidebar_tree_large": true,
"phoenix_solid_current_tab": true,
@Codesleuth
Codesleuth / Trello-Card-ID.js
Last active August 29, 2015 14:22
Trello Card ID Userscript
// ==UserScript==
// @name Trello Card ID
// @namespace http://www.codesleuth.co.uk/
// @version 0.1
// @description Adds card IDs to Trello cards
// @author David Wood (david.p.wood@gmail.com)
// @match https://trello.com/*/*/*
// @grant none
// ==/UserScript==
@Codesleuth
Codesleuth / get-win7-productkey.vbs
Last active August 29, 2015 14:26 — forked from eyecatchup/get-win7-productkey.vbs
VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
' VBS Script to get the Windows(R) 7 Product Key from a PC's registry.
'
' Save the VBScript as "getWin7Key.vbs" somewhere on your Windows7 PC.
' Now, when you double-click the local script file an alertbox pops up
' displaying the product key stored in the machine's Windows registry.
Set WshShell = WScript.CreateObject("WScript.Shell")
KeyPath = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\DigitalProductId"
MsgBox ExtractKey(WshShell.RegRead(KeyPath))
@Codesleuth
Codesleuth / proxy.go
Created August 8, 2015 13:18
Go HTTP Proxy
package main
import (
"fmt"
"net/http"
"net/http/httputil"
)
func HttpRouteHandler(responseWriter http.ResponseWriter, request *http.Request) {
@Codesleuth
Codesleuth / insert-output-select.sql
Last active September 22, 2015 08:40
Example of an INSERT, OUTPUT and SELECT transaction
DECLARE @a uniqueidentifier
DECLARE @b uniqueidentifier
SET @a = newid()
SET @b = newid()
DECLARE @t TABLE
(
a uniqueidentifier,
b uniqueidentifier
See: https://github.com/esendex/esendex-node-sdk
@Codesleuth
Codesleuth / parser.js
Last active April 19, 2016 12:16
Some sort of CSV parser
var readline = require('readline')
var fs = require('fs')
var stream = require('stream')
var util = require('util')
var Transform = stream.Transform
var iconv = require('iconv-lite');
function CSVer(options) {
this.line = ''
@Codesleuth
Codesleuth / Semantic UI Template for Paginate (Almost) Anything.md
Last active July 11, 2017 15:33
Semantic UI Template for Paginate (Almost) Anything
@Codesleuth
Codesleuth / Retryable SQL Script.md
Last active January 26, 2016 13:09
Retryable SQL

Retryable SQL Script

Allows retrying a SQL script until a lock can be achieved necessary to do the work.