Skip to content

Instantly share code, notes, and snippets.

View DanAtkinson's full-sized avatar
🏠
Working from home

Dan Atkinson DanAtkinson

🏠
Working from home
View GitHub Profile
@DanAtkinson
DanAtkinson / GetTuple.cs
Created May 22, 2012 10:48
GetTuple extension
//Based on http://stackoverflow.com/a/4785149/31532
public static Tuple<Expression<Func<T, object>>, SortOrder> GetTuple<T>(this IEnumerable<T> source, Expression<Func<T, object>> expression, SortOrder sortOrder)
{
return new Tuple<Expression<Func<T, object>>, SortOrder>(expression, sortOrder);
}
//Usage
foreach (var per in people.OrderByMany(
people.GetTuple(x => x.Age, SortOrder.Descending),

Keybase proof

I hereby claim:

  • I am danatkinson on github.
  • I am danbo (https://keybase.io/danbo) on keybase.
  • I have a public key whose fingerprint is 25A8 1486 7DD3 97A0 7CD1 89DD F6B4 1A41 F977 8C85

To claim this, I am signing this object:

@DanAtkinson
DanAtkinson / notepadplusplus.install.ketarin.xml
Created June 10, 2015 16:19
Notepad++ Ketarin file after running update
<?xml version='1.0' encoding='utf-8'?>
<Jobs>
<ApplicationJob xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Guid="e76c985a-3b15-4a33-9d85-c05a7d276231">
<WebsiteUrl />
<UserAgent />
<UserNotes />
<LastFileSize>6944290</LastFileSize>
<LastFileDate>2015-06-10T16:26:44.6071395</LastFileDate>
<IgnoreFileInformation>false</IgnoreFileInformation>
<DownloadBeta>Default</DownloadBeta>
@DanAtkinson
DanAtkinson / cssNames.js
Created October 15, 2015 12:10
This is a file containing a JSON object with the valid CSS names, hex values and RGBs.
//Parsed from http://www.w3schools.com/html/html_colornames.asp.
//RGBs derived from functions here: http://www.javascripter.net/faq/hextorgb.htm.
var cssNames = {
AliceBlue: { Hex: "F0F8FF", Red: 240, Green: 248, Blue: 255 },
AntiqueWhite: { Hex: "FAEBD7", Red: 250, Green: 235, Blue: 215 },
Aqua: { Hex: "00FFFF", Red: 0, Green: 255, Blue: 255 },
Aquamarine: { Hex: "7FFFD4", Red: 127, Green: 255, Blue: 212 },
Azure: { Hex: "F0FFFF", Red: 240, Green: 255, Blue: 255 },
Beige: { Hex: "F5F5DC", Red: 245, Green: 245, Blue: 220 },
Bisque: { Hex: "FFE4C4", Red: 255, Green: 228, Blue: 196 },
//Fuskr - background.js - https://github.com/DanAtkinson/Fuskr/blob/master/Scripts/background.js
//Old (starting at line 28)
incDecMenuId = createContextMenu({Id: parentId, Title: "+/-", Context: ["image", "video", "audio", "link"], TargetUrlPatterns: targetUrls });
incMenuId = createContextMenu({Id: parentId, Title: "+", Context: ["image", "video", "audio", "link"], TargetUrlPatterns: targetUrls });
decMenuId = createContextMenu({Id: parentId, Title: "-", Context: ["image", "video", "audio", "link"], TargetUrlPatterns: targetUrls });
for (i = 0; i < numbers.length; i++) {
ids.push([createContextMenu({Id: incDecMenuId, Title: numbers[i], Context: ["image", "video", "audio", "link"], OnclickCallback: choiceOnClick }), 0, numbers[i]]);
ids.push([createContextMenu({Id: incMenuId, Title: numbers[i], Context: ["image", "video", "audio", "link"], OnclickCallback: choiceOnClick }), 1, numbers[i]]);
@DanAtkinson
DanAtkinson / file
Last active November 29, 2016 16:36
freedom_public
{"0.2576952722772956":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgME0VqpYFPlhdu+d1LXbSh9GaxywVgqSYmK\r\ncaAHWliReQ8zh87RD3S6v9PX6JefTl5VWgD2gN5rvrIRCCeVR6iYU83/AAAACDxn\r\naXRodWI+wv8AAACOBBATCABA/wAAAAWCV+j4I/8AAAACiwn/AAAACZAJmc1jLCPl\r\nXf8AAAAFlQgJCgv/AAAABJYDAQL/AAAAApsD/wAAAAKeAQAAGigBANrK6FaXE61a\r\nd42bVXq4KW/JYXgRjSC/4SZRjGcFg9h7AP9XxfNt/PnhpCUu7h4XSI5jdMAPF5OX\r\nxiZr7k+Eg4UU987/AAAAVgQAAAAAEggqhkjOPQMBBwIDBAUXvUh6WTEubUV5K9Rt\r\nSPNTvTIok4g6z+VM5LSoXJMIGonOzUrFCQBcJtmhxzwNEyU1iO2cELFQf0Jasc/0\r\nNykDAQgHwv8AAABtBBgTCAAf/wAAAAWCV+j4I/8AAAAJkAmZzWMsI+Vd/wAAAAKb\r\nDAAANwUA/RoOZZfOVU5h+kcUpwE0vD9VCQM3hmBRVvLJfgUVmjAnAP4vFTGC1MRG\r\nsuwHrAh2vlkhHM/jZu0PwOa9vEstT5BgbQ==\r\n=6OBu\r\n-----END PGP PUBLIC KEY BLOCK-----\r\n","0.3385481372340722":"-----BEGIN PGP PUBLIC KEY BLOCK-----\r\nCharset: UTF-8\r\n\r\nxv8AAABSBAAAAAATCCqGSM49AwEHAgME0VqpYFPlhdu+d1LXbSh9GaxywVgqSYmK\r\ncaAHWliReQ8zh87RD3S6v9PX6JefTl5VWgD2gN5rvrIRCCeVR6iYU83/AAAACDxn\r\naXRodWI+wv8AAACOBB
@DanAtkinson
DanAtkinson / remove-accents.js
Created December 2, 2016 12:03 — forked from monkeymonk/remove-accents.js
AngularJS `removeAccents` filter
angular.module('utils.filters', [])
.filter('removeAccents', removeAccents);
function removeAccents() {
return function (source) {
var accent = [
/[\300-\306]/g, /[\340-\346]/g, // A, a
/[\310-\313]/g, /[\350-\353]/g, // E, e
/[\314-\317]/g, /[\354-\357]/g, // I, i
/[\322-\330]/g, /[\362-\370]/g, // O, o
@DanAtkinson
DanAtkinson / tooltipDirective.js
Created December 22, 2016 10:42
Really simple Angular tooltip directive that makes use of PNotify.
/*globals angular:false */
/* Tooltip directive */
(function (angular) {
'use strict';
var app = angular.module('app');
//Actions are performed in here.
app.directive('tooltip', function ($sce, $compile) {
@DanAtkinson
DanAtkinson / GetFilesOlderThan30Mins.ps1
Last active May 27, 2021 05:45
Simple Powershell script to get files older than 30 minutes. Obviously adaptable as needed.
$fullPath = "D:\path\to\directory"
$numDays = 0
$numHours = 0
$numMins = 30
function getOldFiles($path, $maxDays, $maxHours, $maxMins) {
$currDate = Get-Date
#Get all children in the path where the last write time is greater than 30 minutes. psIsContainer checks whether the object is a folder.
$oldFiles = @(Get-ChildItem $path -include *.* -recurse | where {($_.LastWriteTime -lt $currDate.AddDays(-$maxDays).AddHours(-$maxHours).AddMinutes(-$maxMins)) -and ($_.psIsContainer -eq $false)})
@DanAtkinson
DanAtkinson / CommandLineHack.html
Last active January 26, 2017 23:30
Example of how to lull a user into executing potentially dangerous commands into their Windows command prompt by 'injecting' hidden code using CSS.
<!doctype html>
<html>
<head>
<title>Windows code sample 'hack'</title>
</head>
<body>
<h1>Code sample</h1>
<p>Copy and paste the below code sample into your command prompt to see your directory paged... And other stuff...</p>
<p>Inspiration taken from <a href="http://lifepluslinux.blogspot.com.au/2017/01/look-before-you-paste-from-website-to.html">Suresh Alse</a>. For a little more information, see my <a href="https://danatkinson.github.io/2017/01/26/How-to-hack-a-trusting-developer-s-machine/" title="How to hack a trusting Windows developer's machine">blog post</a> at danatkinson.github.io.</p>
<code style="background-color:#eeeeee;padding:10px;">