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 gist contains JavaScript functions and tests for: | |
// - conversion from gamma-corrected (or gamma-compressed) sRGB to linear RGB, to Oklab | |
// - interpolation through Oklab | |
// - conversion back to linear RGB, then sRGB | |
// To use these tests, install nodejs, save this file locally, and run with: | |
// node OklabExperiments.js | |
// No other dependencies are required to use this. | |
// Thanks to some helpful folks in the generative art community for helping me better understand what's happening with this. | |
// My toddler smacked the keyboard with a piece of cardboard and made me accidentally type: |
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
# Modified StyleGAN2 Projector with CLIP, addl. losses, kmeans, etc. | |
# by Peter Baylies, 2021 -- @pbaylies on Twitter | |
# Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. | |
# | |
# NVIDIA CORPORATION and its licensors retain all intellectual property | |
# and proprietary rights in and to this software, related documentation | |
# and any modifications thereto. Any use, reproduction, disclosure or | |
# distribution of this software and related documentation without an express | |
# license agreement from NVIDIA CORPORATION is strictly prohibited. |
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 json | |
import sys | |
if len(sys.argv) < 2: | |
print("infojsonredact - A simple script to redact private information from ytdl info.json files") | |
print("Output will be saved in info.json.redacted files") | |
print("Usage: infojsonredact.py file1.info.json [file2.info.json, file3.info.json...]") | |
sys.exit(2) | |
redacted = ["url","manifest_url","fragment_base_url","fragments","http_headers","User-Agent","Accept-Charset","Accept","Accept-Encoding","Accept-Language","player_url","playlist","playlist_id","playlist_title","playlist_uploader","playlist_uploader_id","playlist_index","thumbnail","_filename","downloader_options","http_chunk_size","initialization_url","annotations", "playlist_count","version","_version","repository","release_git_head","filesize_approx","_format_sort_fields"] |
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
var str = '0x41FC6733'; | |
function parseFloat(str) { | |
var float = 0, sign, order, mantiss,exp, | |
int = 0, multi = 1; | |
if (/^0x/.exec(str)) { | |
int = parseInt(str,16); | |
}else{ | |
for (var i = str.length -1; i >=0; i -= 1) { | |
if (str.charCodeAt(i)>255) { |
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
function downloadString(text, fileType, fileName) { | |
var blob = new Blob([text], { type: fileType }); | |
var a = document.createElement('a'); | |
a.download = fileName; | |
a.href = URL.createObjectURL(blob); | |
a.dataset.downloadurl = [fileType, a.download, a.href].join(':'); | |
a.style.display = "none"; | |
document.body.appendChild(a); | |
a.click(); |