Skip to content

Instantly share code, notes, and snippets.

View MTco's full-sized avatar
😞

Mathew Tyler MTco

😞
View GitHub Profile
@DavidLutton
DavidLutton / kindle.py
Last active January 16, 2024 19:29
Make use of a Kindle as a ePaper display
import time
from datetime import datetime
from textwrap import wrap
import requests
from requests_html import HTMLSession
import paramiko
import schedule
def get_traffic(road):
@ow
ow / Chromium flags for PWAs.md
Last active January 27, 2021 23:42
Chromium flags for PWAs

Upcoming flags to enable link capturing and other PWA features. Enable these flags by copying and pasting the following, then searching for the below chrome://flags/

Enable full desktop integration:
chrome://flags/#enable-desktop-pwas

Capture URLs in their scope, such as twitter URLs for the Twitter PWA:
chrome://flags/#enable-desktop-pwas-link-capturing chrome://flags/#enable-desktop-pwas-stay-in-window

Get a pop-up that offers to allow the PWA to open certain URLs:

@jenovs
jenovs / kindle_hack.js
Created August 16, 2018 17:37
Enable dictionaries on Kindle online reader
// https://learnoutlive.com/german-english-dictionary-kindle-cloud-reader/
javascript: (function() {
/* based on ACRExtensions via https://github.com/binarycrafts/ACRExtensions */
var w = null;
var kDoc = null;
var kObj = null;
if (typeof window.KindleReaderContextMenu !== 'undefined') {
w = window;
@JLChnToZ
JLChnToZ / _readme.md
Last active April 17, 2024 04:12
Simple bookmarklet that captures any webpage and save as png image using HTML5 technologies

Webpage Snapshot Bookmarklet

This is a simple bookmarklet that captures any webpage and save as png image using HTML5 technologies. Under the hood it uses HTML2Canvas to capture the webpage to canvas, then we convert the content inside this canvas element to image file.

You may copy the text below and save as bookmark. `javascript:!function()%7Bfunction%20e()%7Bthis&&this.parentNode&&this.parentNode.removeChild(this),html2canvas(document.body).then(function(e)%7Breturn%20new%20Promise(function(t)%7Be.toBlob(t)%7D)%7D).then(function(e)%7Bvar%20t=document.createElement(%22a%22);return%20t.href=URL.createObjectURL(e),t.download=document.title.replace(/%5B/%5C%7C%5C%5C%60~!@#%5C$%25%5C%5E&%5C*%5C+%5C-='%22%5C,%5C.:;%5D+/g,%22%22)+%22_%22+(new%20Date).getTime()+%22.png%22,t.click(),new%20Promise(function(e)%7BsetTimeout(10,e,t)%7D)%7D).then(function(e)%7B0===e.href.indexOf(%22blob:%22)&&(URL.revokeObjectURL(e.href),e.href=%22###%22)%7D).catch(function(e)%7Bconsole.error(e)

const assert = require('assert')
const BLUEBIRD = require('bluebird')

const nameAsync1 = async (name) => name
const nameAsync2 = (name) => Promise.resolve(name)
const nameAsync3 = (name) => BLUEBIRD.resolve(name)
const nameSync = (name) => name

const isPromise1 = (value) => Promise.resolve(value) === value
@erlepereira
erlepereira / DNSMasq_withMalwareBlocking.md
Last active February 22, 2024 07:00
Using DNSMasq as a caching nameserver & add in a malware etc blocking

Assuming a Properly configured DNSMasq

a quickstart for dnsmasq is given at the end if you have not set it up yet.

something like this will add a great regularly updated malware file for it to use. More security and privacy to you! Specifically, this uses https://github.com/StevenBlack/hosts Choose one of the Raw Hosts file from there to use.

To setup DNSMasq, follow the below ...

wget -O- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf`
@orion110217
orion110217 / localStorage.txt
Last active June 9, 2020 21:00
Polyfills localStorage and sessionStorage when cookies are disabled.
const hasLocalStorage = (function(){
try {
localStorage.setItem('mod', 'mod');
localStorage.removeItem('mod');
return true;
} catch(e) {
return false;
}
})()
@oliveratgithub
oliveratgithub / emojis.json
Last active May 19, 2024 01:07
Emoji-list with emojis, names, shortcodes, unicode and html entities [massive list]
{
"emojis": [
{"emoji": "👩‍👩‍👧‍👧", "name": "family: woman, woman, girl, girl", "shortname": ":woman_woman_girl_girl:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F467", "html": "👩‍👩‍👧‍👧", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👧‍👦", "name": "family: woman, woman, girl, boy", "shortname": ":woman_woman_girl_boy:", "unicode": "1F469 200D 1F469 200D 1F467 200D 1F466", "html": "👩‍👩‍👧‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👩‍👩‍👦‍👦", "name": "family: woman, woman, boy, boy", "shortname": ":woman_woman_boy_boy:", "unicode": "1F469 200D 1F469 200D 1F466 200D 1F466", "html": "👩‍👩‍👦‍👦", "category": "People & Body (family)", "order": ""},
{"emoji": "👨‍👩‍👧‍👧", "name": "family: man, woman, girl, girl", "shortname": ":man_woman_girl_girl:", "unicode": "1F468 200D 1F469 200D 1F467 200D 1F467", "html": "👨‍👩&z
@svenk
svenk / ViewSourceWith.ps1
Created November 17, 2017 11:59
A Firefox Quantum ViewSourceWith extension workaround with Firefox's source.editor.external
# A Firefox Quantum ViewSourceWith replacement for Windows
#
# Usage:
# (1) Save as C:\path\to\script.ps1
# (2) In order to run your own powershell scripts, start PowerShell
# as Administrator and run the command
#
# Set-ExecutionPolicy RemoteSigned
#
# (2) You can test the proper running (from a user cmd):
@andrewroberts
andrewroberts / fillInHtmlTemplate.gs
Created September 17, 2017 10:02
Google Apps Script function to replace placeholder values in an HTML template (from a draft GMail for example)
/**
* For each placeholder - "{{[placeholder]}}", strip out any HTML and replace
* it with the appropriate key value. An example use of this could be using the
* HTML from a draft GMail as a template.
*
* E.g. If the obect were:
*
* {PlaceHolder1: newValue}
*
* In the template "{{PlaceHolder1}}" would be replaced with "newValue" even