- open
chrome://extensions/
and turn on "Developer Mode" on the top right - install tampermonkey:
https://chromewebstore.google.com/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo
- click on the extension, then click "create a new script"
- in the editor, copy the userscript.js file contents
- install python, flask, and run server.py
This file contains hidden or 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
javascript: function captureVideoScreenshot() { const video = document.querySelector('video'); if (!video) { console.error('No video element found.'); return; } const canvas = document.createElement('canvas'); canvas.width = video.videoWidth; canvas.height = video.videoHeight; const ctx = canvas.getContext('2d'); ctx.drawImage(video, 0, 0, canvas.width, canvas.height); const link = document.createElement('a'); link.href = canvas.toDataURL('image/png'); link.download = 'screenshot.png'; link.click();}captureVideoScreenshot(); |
This file contains hidden or 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
import bpy, sys, os | |
# enable GPU rendering if possible | |
# use whatever device type is available, in oder of device_type_preferences left-to-right | |
def set_device_type(device_type_preferences=['OPTIX', 'CUDA', 'CPU']): | |
prefs = bpy.context.preferences | |
cycles_prefs = prefs.addons['cycles'].preferences | |
enabled_devices = [] | |
for device_type_preference in device_type_preferences: |
This file contains hidden or 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
# generic place name maps in great britain (not northern ireland, my dataset didn't include it) | |
# I used the place name data from https://www.ordnancesurvey.co.uk | |
# it doesn't include latitude or longitude, rather "geometry_x", "geometry_y" values which correspond | |
# to the british ordinance survey national grid | |
# where 'geometry_x' is the number of metres east of the southwest corner of the grid | |
# and 'geometry_y' is the number of metres north of the southwest corner of the grid | |
# I am using the sgo library to convert BNG to WGS84 | |
# (note: WGS84 is the standard, google maps location format) |
This file contains hidden or 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
// this adds a command to re-run the previous bash command | |
// asuming you git-bash or another bash terminal open inside of vscode | |
// update the keybindings json array as follows | |
[ | |
// run `!!` in terminal (repeats last bash command) | |
{ | |
"key": "shift+enter", | |
"command": "workbench.action.terminal.sendSequence", | |
"args": { | |
"text": "!!\r" |
This file contains hidden or 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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>canvas</title> | |
</head> | |
<body> | |
<canvas> </canvas> | |
<script> |
This file contains hidden or 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
/* | |
https://wiki.factorio.com/Blueprint_string_format | |
turn blueprint string to json | |
*/ | |
import fs from "fs"; | |
import { unzip } from "zlib"; | |
// returns a flagged argument value, if found | |
function getFlaggedArg(flag) { |
This file contains hidden or 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
# note: zlib-flate is part of the 'qpdf' package | |
tail -c +2 factoriostring.txt | base64 -d | zlib-flate -uncompress |
This file contains hidden or 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
javascript:(function getURLTime() { const params = (new URL(document.location)).searchParams; const v = params.get('v'); const ytplayer = document.getElementById("movie_player"); const t = Math.round(ytplayer.getCurrentTime()); const newUrl = `https://youtu.be/${v}?t=${t}`; return alert(newUrl); })() |
This file contains hidden or 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
#!/bin/bash | |
function printUsage() { | |
echo "usage: bash $0 -i <inurl> -ss <starttime> -t <duration> -o <outfile>" | |
echo ' other args are passed directly to youtube-dl; eg, -r 40K' | |
} | |
if [ "$#" -eq 0 ]; then | |
printUsage | |
exit |
NewerOlder