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
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 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 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 | |
[ | |
{ | |
"key": "shift+enter", | |
"command": "workbench.action.terminal.sendSequence", | |
"args": { | |
"text": "!!\r" | |
} |
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
<!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 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 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 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 getURLTime() { | |
const params = (new URL(document.location)).searchParams | |
if(params.has('v')) { | |
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 newUrl; | |
} | |
return document.location; |
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
#!/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 |
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 YouTube Persistent Live Chat | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description Try to keep youtube livestream chat in "live chat" or "live chat replay" mode | |
// @include https://www.youtube.com/* | |
// @icon data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw== | |
// @grant none | |
// ==/UserScript== |
NewerOlder