Skip to content

Instantly share code, notes, and snippets.

@willh
willh / deeplens_reset.txt
Created January 29, 2018 22:15
AWS DeepLens factory reset and fix updated dependencies issues
AWS DeepLens factory reset steps followed:
Get Ubuntu and microSD card set up using AWS forum supplied instructions
https://s3.amazonaws.com/deeplens-public/factory-restore/DeepLens_System_Restore_Instruction.pdf
Pre-requisites: borked DeepLens in need of restore
keyboard
micro HDMI cable
monitor
bootable Ubuntu live USB
package com.willhamill.lambda.apigateway;
public class Identity {
private String cognitoIdentityPoolId;
private String accountId;
private String cognitoIdentityId;
private String caller;
private String apiKey;
private String sourceIp;
package com.willhamill.lambda.apigateway;
public class RequestContext {
private String accountId;
private String resourceId;
private String stage;
private String requestId;
private Identity identity;
private String resourcePath;
package com.willhamill.lambda.apigateway;
import java.util.Map;
/*
Response class for an API Gateway proxied lambda
Must conform to these three properties as per AWS docs
https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-output-format
Headers map will be merged with whichever header AWS sets, e.g. X-Amzn-Trace-Id
*/
package com.willhamill.lambda.apigateway;
import java.util.Map;
/*
API Gateway Request object defined [mostly] as per AWS documentation:
http://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-set-up-simple-proxy.html#api-gateway-simple-proxy-for-lambda-input-format
**WARNING** The AWS docs appear to be somewhat inaccurate in the following way:
- message property does not exist on request
@willh
willh / clickbait_removal_bookmarklet.js
Created August 31, 2015 18:03
Clean up Guardian articles to remove inane clickbait
Step 1: Select and copy the following javascript (triple click on the line for easy selecting)
javascript: (function() { var elems = document.getElementsByTagName('p'); for (var i in elems) { if (typeof(elems[i]) != 'object') continue; if((' ' + elems[i].className + ' ').indexOf(' ' + 'byline' + ' ') >= 0) { var byline = elems[i]; if (byline.innerHTML.indexOf('Jonathan Jones') != -1) { byline.parentNode.parentNode.style.display = 'none'; } } }})();
Step 2: Right click on your bookmark bar and click on 'Add Page'
Step 3: Enter 'Guardian Cleanup' in Name and paste the javascript from step 1 as the url
Step 4: Click Save to create bookmarklet
Step 5: Demo by navigating to sample page http://www.theguardian.com/artanddesign/jonathanjonesblog/2015/aug/31/terry-pratchett-is-not-a-literary-genius and clicking 'Guardian Cleanup' in your bookmark bar
import org.junit.Test;
import static org.junit.Assert.fail;
public class StringComparisonTest {
@Test
public void testCompileTimeVariable() {
String testCompileTimeString = "compileTime";
@willh
willh / facebook.user.js
Created November 20, 2012 21:49
Facebook ads removal UserJS
// ==UserScript==
// @name Facebook Cleanup
// @description Remove ads from your Facebook page
// @author @willhamill
// @include https://facebook.com/*
// @include https://www.facebook.com/*
// @include http://facebook.com/*
// @include http://www.facebook.com/*
// ==/UserScript==
@willh
willh / hideTweets.user.js
Last active October 8, 2015 18:48
Clean up Twitter by hiding tweets by matching on content and removing trends and 'promoted' tweets
// ==UserScript==
// @name Twitter Cleanup
// @description Remove crap from your Twitter feed without unfollowing people
// @author @willhamill
// @include https://twitter.com/*
// @include https://www.twitter.com/*
// @include http://twitter.com/*
// @include http://www.twitter.com/*
// ==/UserScript==