Skip to content

Instantly share code, notes, and snippets.

Damien Guard damieng

Block or report user

Report or block damieng

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@damieng
damieng / gist:5725720
Created Jun 6, 2013
Simple pattern for background ASP.NET tasks. Just BackgroundService.Start(SomeMethod, TimeSpan.SomeInterval). Based on Phil Haack's sample.
View gist:5725720
public class BackgroundService : IRegisteredObject
{
public static void Start(Action action, TimeSpan interval)
{
var backgroundService = new BackgroundService(interval, action);
HostingEnvironment.RegisterObject(backgroundService);
}
private Timer timer;
@damieng
damieng / gist:50ccbc199fc251d65d87
Last active Aug 29, 2015
build.sbt for a Spark Streaming 1.2.1 job using Scala 2.10 that can assemble (remote) or run (local)
View gist:50ccbc199fc251d65d87
name := "MyApp"
version := "1.0"
scalaVersion := "2.10.4"
libraryDependencies ++= Seq(
// Use Log4J 1.2.17 instead of the unresolvable jmx of 1.2.15
"log4j" % "log4j" % "1.2.17",
// Spark components - some provided on the cluster
@damieng
damieng / fix-wos-screenshots.user.js
Created May 8, 2015
Make the World of Spectrum screenshots work again (a Greasemonkey script)
View fix-wos-screenshots.user.js
// ==UserScript==
// @name Fix WoS screenshots
// @namespace http://damieng.com
// @version 0.1
// @description Make the World of Spectrum screenshots work again
// @author Damien Guard
// @include http://www.worldofspectrum.org/*
// ==/UserScript==
var images = document.getElementsByTagName('img');
@damieng
damieng / WinDev.ps1
Last active Apr 6, 2019
Make Windows more developer-workstation oriented (includes removing crapware)
View WinDev.ps1
# Run this from Powershell as Administrator with (New-Object System.Net.WebClient).DownloadString("https://gist.github.com/damieng/881852e7112be7d97957/raw") | powershell -command -
Write-Output "Making Windows more developer oriented (Revision 26)..."
Set-ExecutionPolicy Unrestricted
if ([System.Environment]::OSVersion.Version.Major -ge 10) {
Write-Output " * Detected Windows 10"
Write-Output " * Removing Windows 10 bloatware"
$apps = @(
"Microsoft.3DBuilder"
@damieng
damieng / WordPressNoiseRemoval.php
Last active Apr 12, 2016
Remove WordPress noise from pages
View WordPressNoiseRemoval.php
<?php
// Put this in your themes functions.php to remove WordPress noise
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'wlwmanifest_link');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
remove_action('wp_print_styles', 'print_emoji_styles');
@damieng
damieng / DownloadAllByNumber.ps1
Created May 27, 2016
Bulk download files from a url by specifying a wildcard and numeric range
View DownloadAllByNumber.ps1
$sourcePattern = "http://something.com/somepath/somefile*.jpg"
$targetDir = "c:\downloads"
$count = 256
New-Item -Path $targetDir -ItemType Directory -Force
for ($i=1; $i -le $count; $i++) {
$source = $sourcePattern.Replace("*", $i)
$parts = $source.Split('/')
$target = Join-Path $targetDir $parts[$parts.Length - 1]
echo "Downloading $source to $target"
@damieng
damieng / start-crash-server.coffee
Created Jul 20, 2016
Grunt http server in Coffeescript
View start-crash-server.coffee
http = require('http')
module.exports = (grunt) ->
grunt.registerTask 'local-crash-reporter', 'Start a local crash reporter server.', ->
PORT = 1127
done = this.async()
server = http.createServer (request, response) ->
if request.method is 'POST'
body = []
@damieng
damieng / DoDumpCPC.bat
Created Aug 29, 2016
Dump Amstrad CPC and Spectrum +3 disks using Kryoflux
View DoDumpCPC.bat
@echo off
:WARMUP
set DTC_GameTitle=none
set DTC_NumberOfDisks=1
set DTC_Publisher=none
set DTC_ReleaseType=none
set DTC_Year=none
set DTC_Platform=none
set DTC_RecommendedModel=none
@damieng
damieng / identify-pe-arch.js
Last active Oct 28, 2016
Identify 64-bit and 32-bit PE binaries in a path
View identify-pe-arch.js
#!/usr/bin/env node
const fs = require('fs')
const path = require('path')
const process = require('process')
var rootPath
if (process.argv.length > 2) {
rootPath = process.argv[2]
} else {
@damieng
damieng / nsfw-watcher.js
Created Oct 28, 2016
Watch the filesystem using NSFW from the command line
View nsfw-watcher.js
#!/usr/bin/env node
const nsfw = require('nsfw')
const process = require('process')
const path = require('path')
if (process.argv.length == 0) {
console.log(`Usage: ${process.argv[0]} [path]`)
process.exit(0)
}
You can’t perform that action at this time.