This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dumpPow(b, e) { | |
const steps = []; | |
console.log(`Raise ${b} to ${e}`); | |
for(let j = 0; j <= e; j++) { | |
const v = Math.pow(b, j); | |
const len = v.toString().length; | |
steps.push({ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name QuizletPrint | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Cleanup for quizlet print | |
// @author John Lewin | |
// @match https://quizlet.com/* | |
// @grant none | |
// ==/UserScript== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Extracts the content of textNode children, skipping descendant elements | |
function getTextContent(e) { | |
return [...e.childNodes] // has childNodes inside, including text ones | |
.filter(child => child.nodeType === 3) // get only text nodes | |
.filter(child => child.textContent.trim()) // eliminate empty text | |
.map(textNode => textNode.textContent) // extract text content | |
.join('').trim(); | |
} | |
// Selects either the .answer_html, .answer_text, or textContent of the given element |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var lastNode = null; | |
var video = document.createElement('iframe'); | |
video.setAttribute('name','jlFrame'); | |
video.style = `display: block; | |
width: 1900px; | |
float: right; | |
position: absolute; | |
right: 0px; | |
min-height: 100vh; | |
top: 0px; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Drop undesired items | |
var removeList = ['Nespresso', 'Vertuo', 'Delonghi', 'De’Longhi', "De'longhi", 'Gevi', 'Calphalon', 'Ascaso', 'Mr ', 'Mr.', 'Krups', 'Keurig','Chefman','Conqueco', 'CBTL', 'Mattina', 'Terra', 'Smeg', 'EspressoWorks', 'Arlime', 'Bambino']; | |
// Remove matching results (and ads) | |
var links = Array.from(document.querySelectorAll('a')); | |
links.filter(l => l.href.includes('bing.com') || | |
(l.href.includes('/item/detail') && | |
removeList.some(r => l.title.toLowerCase().includes(r.toLowerCase())))) | |
.forEach(e => e.parentElement.removeChild(e)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.querySelectorAll(".screenreader-only").forEach(e => e.remove()); | |
document.querySelectorAll('#grades_summary tr.student_assignment').forEach(r => { | |
if (r.cells[3].innerText === r.cells[4].innerText) { | |
r.style.display = 'none'; | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FOR /R %a IN (*.tif) DO magick convert "%~a" -quality 100 "%~dpna.jpg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// As described in https://stackoverflow.com/q/26162902/84369 | |
public ActionResult Index() | |
{ | |
var sketches = db.Sketches.Include(p => p.Board); | |
// Serializer settings | |
var settings = new JsonSerializerSettings | |
{ | |
ContractResolver = new CustomResolver(), | |
PreserveReferencesHandling = PreserveReferencesHandling.None, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From stackoverflow and adapted to unusure it makes sense with our data | |
// -- https://stackoverflow.com/questions/38725038/c-sharp-how-to-verify-signature-on-jwt-token | |
void Main() | |
{ | |
var jwt = "some-jwt"; | |
var segments = jwt.Split('.'); | |
var decoded = segments.Select(s => System.Text.Encoding.UTF8.GetString(Convert.FromBase64String(s))); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 2.7.16 (v2.7.16:413a49145e, Mar 4 2019, 01:37:19) [MSC v.1500 64 bit (AMD64)] on win32 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> from datetime import datetime, timedelta | |
# Store start | |
>>> start = datetime.now() | |
# Get timespan by subtracting start from now | |
>>> elapsed = datetime.now() - start |
NewerOlder