Skip to content

Instantly share code, notes, and snippets.

View mhingston's full-sized avatar

Mark Hingston mhingston

View GitHub Profile
@mhingston
mhingston / repair.md
Last active September 26, 2020 10:23
Online Repair Windows 10 using DISM
  1. Download Windows 10 Media Creation Tool.

  2. Run the tool (Right-click > Run as administrator).

  3. Click Accept.

  4. Click "Create Installation Media for another PC" then Next.

  5. Leave box checked for "Use the recommended options for this PC" then Next.

@mhingston
mhingston / XOR.js
Created October 6, 2016 16:32
XOR encryption/decryption for the browser (IE10+)
var XOR =
{
encrypt: function(input, key)
{
input = typeof input === 'object' ? JSON.stringify(input) : input.toString();
key = typeof key === 'object' ? JSON.stringify(key) : key.toString();
var cipherText = '';
var length = input.length;
for(var i=0; i < length; i++)
@mhingston
mhingston / calculate.js
Created October 14, 2016 10:54
Calculate without eval
const calculate = (expression) =>
{
return new Function(`return ${expression}`)();
}
calculate('1+2/3*4')
@mhingston
mhingston / range.js
Created December 26, 2016 22:00
Python's range() for javascript
const range = (start, stop, step) =>
{
const output = [];
if(stop === undefined)
{
stop = start;
start = 0;
}
@mhingston
mhingston / xrange.js
Created December 26, 2016 22:19
Python's xrange() for javascript
function* xrange(start, stop, step)
{
if(stop === undefined)
{
stop = start;
start = 0;
}
if(step === undefined)
{
@mhingston
mhingston / PrivacyGuard.js
Created December 29, 2016 15:37
A few privacy enhancements for browsers
// ==UserScript==
// @name Privacy Guard
// @namespace https://jumpkick.io/
// @version 1.0.0
// @author Miles Hingston
// @include *
// @grant none
// ==/UserScript==
(function() {
@mhingston
mhingston / SwipeToRefresh.js
Last active January 14, 2023 09:26
Swipe to refresh for browsers
// ==UserScript==
// @name Swipe to Refresh
// @namespace https://jumpkick.io/
// @version 1.0.0
// @author Miles Hingston
// @include *
// @noframes
// @grant none
// ==/UserScript==
@mhingston
mhingston / mastodon.js
Created September 19, 2017 20:26
Mastodon bookmarklet
javascript:(function(){var _={};_.title=top.document.title,_.link=top.location.href,_.height=300,_.width=300,_.left=(screen.width/2)-(_.width/2),_.top=(screen.height/2)-(_.height/2);window.open('https://mastodon.social/share?text='+_.title+' '+_.link,'_blank','height='+_.height+',width='+_.width+',left='+_.left+',top='+_.top)}())

Keybase proof

I hereby claim:

  • I am mhingston on github.
  • I am mhingston (https://keybase.io/mhingston) on keybase.
  • I have a public key ASA8MoLjFXfmwfLyDZKnNYHEY1Kl1ZTfI1cR0YAg1aZapwo

To claim this, I am signing this object:

@mhingston
mhingston / app.js
Created February 5, 2018 14:00
Use ACRCloud (https://www.acrcloud.com) to identify songs from a digital radio station and email you when the same artist plays 3 times in a row.
/*
Use ACRCloud (https://www.acrcloud.com) to identify songs from a digital radio station and email you when the same artist plays 3 times in a row which could be useful for certain radio competitions (e.g. http://www.heart.co.uk/radio/win-with-hearts-30k-triple-play/). This is just a proof on concept.
npm init -y
npm install --save lodash mailgun-js express body-parser
1) Edit the config as below, you'll need a Mailgun API key for sending emails.
2) Run this app server behind a reverse proxy like NGINX.
3) Setup broadcast monitoring on ACRCloud.