Skip to content

Instantly share code, notes, and snippets.

View SteGriff's full-sized avatar
🏝️
ohayo aloha

Stephen Griffiths SteGriff

🏝️
ohayo aloha
View GitHub Profile
@SteGriff
SteGriff / dumbSizzler.js
Created May 12, 2014 10:08
Dumb sizzler
function $(x){
return ((x[0]=="#") ? document.getElementById(x.substr(1)) : document.getElementsByTagName(x)[0]);
}
@SteGriff
SteGriff / HideMouseCE.cs
Created February 11, 2015 15:27
Hide the mouse in Windows CE by moving it off-screen
using System.Runtime.InteropServices;
namespace MyProject.Classes
{
public static class WinApi
{
[DllImport("coredll.dll", SetLastError = true)]
private static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, int dwExtraInfo);
private enum MouseFlags
@SteGriff
SteGriff / software_lister.bat
Created February 12, 2015 11:10
Use Windows registry to produce text file of all installed software
@echo off
echo Software List > software_list.txt
echo ================= >>software_list.txt
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall temp1.txt
find "DisplayName" temp1.txt| find /V "ParentDisplayName" > temp2.txt
for /f "tokens=2,3 delims==" %%a in (temp2.txt) do (echo %%a >> software_list.txt)
del temp1.txt temp2.txt
@SteGriff
SteGriff / MatchingFileWithUnknownExtension.cs
Created March 24, 2015 14:25
Given a file path which is missing the file extension, search the directory for a matching file and return its full path, including extension
/// <summary>
/// Given a path to a file which is missing the file extension, search the directory
/// for a matching file and return its full path (with extension)
/// </summary>
/// <param name="localPath">Path to a file without file extension</param>
/// <returns>The path with the file extension</returns>
private static string MatchingFileWithUnknownExtension(string localPath)
{
string directory = Path.GetDirectoryName(localPath);
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(localPath);
@SteGriff
SteGriff / Fix Windows CE build problems.md
Last active September 25, 2022 19:12
Fix Windows CE build problems

Windows CE Build problems

I had trouble setting up a Windows CE project to build on our new Jenkins server. These gists are meant to help you resolve "error MSB4018: The "GetDeviceFrameworkPath" task failed unexpectedly."

Steps

  • Make sure that the machine performing the build has the .NET Compact Framework Redistributable
  • Add the registries from Windows-CE-Build.reg to the machine (by downloading and double-clicking the file)

Sources

@SteGriff
SteGriff / 10k most common with frequency.txt
Created August 13, 2015 09:31
The 10000 most common passwords from 2011
password, 32027
123456, 25969
12345678, 8667
1234, 5786
qwerty, 5455
12345, 4523
dragon, 4321
pussy, 3945
baseball, 3739
football, 3682
@SteGriff
SteGriff / README.md
Last active September 8, 2015 14:55 — forked from kerryrodden/.block
Sequences sunburst

This example shows how it is possible to use a D3 sunburst visualization (partition layout) with data that describes sequences of events.

A good use case is to summarize navigation paths through a web site, as in the sample synthetic data file (visit_sequences.csv). The visualization makes it easy to understand visits that start directly on a product page (e.g. after landing there from a search engine), compared to visits where users arrive on the site's home page and navigate from there. Where a funnel lets you understand a single pre-selected path, this allows you to see all possible paths.

Features:

  • works with data that is in a CSV format (you don't need to pre-generate a hierarchical JSON file, unless your data file is very large)
  • interactive breadcrumb trail helps to emphasize the sequence, so that it is easy for a first-time user to understand what they are seeing
  • percentages are shown explicitly, to help overcome the distortion of the data that occurs wh
@SteGriff
SteGriff / umb-db-freshness.sql
Last active September 10, 2015 14:18
Umbraco Database Freshness Check
select
max(ID) as "Newest node",
count(*) as "Total nodes",
(select top(1) [timestamp] from cmsPreviewXml order by [timestamp] desc) as "Latest preview"
from umbracoNode
go
@SteGriff
SteGriff / timing.php
Created September 28, 2015 11:05
Micro-benchmark timing with PHP
<?php
function startTiming(){
$GLOBALS['start'] = microtime(true);
}
function stopTiming(){
$duration = (microtime(true) - $GLOBALS['start']);
return $duration;
}
@SteGriff
SteGriff / web.config
Created February 7, 2016 16:30
Sensible rewrite-all-to-index for PHP on IIS
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="SpecificRewrite" stopProcessing="true">
<match url="^" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />