Skip to content

Instantly share code, notes, and snippets.

View cocoabox's full-sized avatar

cocoabox cocoabox

View GitHub Profile
@cocoabox
cocoabox / nostalgic-dos-text-ui.md
Last active September 30, 2024 13:09
nostalgic text UI (TUI) in DOS

tl;dr

Because I love TextUI, and TextUI in DOS is beautiful and technically non-trivious, I have gathered some information on the internet, and I want to write a small summary of familiar "frameworks" I encountered, their aesthetics and some technical details if available.

While there are many TextUIs, I focus on mainly aesthetics/frameworks that are used by more than one products.

Table of Contents

@cocoabox
cocoabox / UIASM.OBJ.base64
Last active May 27, 2024 16:34
build uidemo.bas from BASIC 7.1
gAsACXVpYXNtLmFzbd6WKgAAClVJQVNNX1RFWFQFX0RBVEEGREdST1VQBV9URVhUBERBVEEEQ09ERdiYBwBIAAAFBwEMmAcASA8AAwYBAJgHAEj/AQIHAQ+aBAAE/wJdjBAADVNUUklOR0FERFJFU1MAepBFAAADCmdldGNvcHlib3goAAAJZ2V0X21lbXh5FwAACmdldF9zY3JzZWcAAAAKcHV0Y29weWJveNgAAAdhdHRyYm94ZwEA4YgEAACiAdGgAwIDAABQtA/NEMcGAAAAuDwHdQbHBgAAALBYy1JQsqD24lqK1rYAAtIDwlrLVYvsHgZWV4teDosHogAAi14MiweiAACLXgqLB6IAAIteCIsHogAAi14GU5oAAAAAowAAiRYAAP4OAAD+DgAA/g4AAP4OAAAO6I3/oAAAKgYAAKIAAAQBtACjAACgAAAqBgAAogAAjgYAAIs+AAC+AACkvgAApKAAAIomAAAO6G7/i/CLDgAAHo4eAADzpR+BxqAAKzYAACs2AACAPgAAAHQG/g4AAOvbX14HH13KCgBVi+weBlZXi14KiweiAACLXgiLB6IAAIteBlOaAAAAAKMAAIkWAAD+DgAA/g4AAA7o9f4eB4s2AAAejh4AAL8AAKS/AACkH6AAAAQBtACjAACKJgAAoAAADujj/ov4jgYAAIsOAAAejh4AAPOlH4HHoAArPgAAKz4AAIA+AAAAdAb+DgAA69tfXgcfXcoGAFWL7B4GVleLXg6LB6IAAIteDIsHogAAi14KiweiAACLXgiLB6IAAIteBosHogAA/g4AAP4OAAD+DgAA/g4AAA7oVv6gAAAqBgAA/sAy5KMAAKAAACoGAACiAACgAACKJgAADuhK/ov4jgYAAKAAAIsOAABHquL8gcegACs+AAArPgAAgD4AAAB0Bv4OAADr319eBx9dygoALZwZAsQHEAECCwDEERABAgsAxDUQAQICAMQ9EAECAQDERRABAgQAxE0QAQIDAMxUVgHEWRABAgcA
@cocoabox
cocoabox / google2duckduckgo.js
Created November 20, 2023 05:56
google 検索結果を duckduckgo に変換するBookmarklet
javascript:(function() { var currentUrl = window.location.href; var searchQueryMatch = currentUrl.match(/q=([^&]+)/); if (searchQueryMatch && searchQueryMatch[1]) { var decodedSearchQuery = decodeURIComponent(searchQueryMatch[1].replace(/\+/g, ' ')); var duckDuckGoUrl = 'https://duckduckgo.com/?t=h_&q=' + encodeURIComponent(decodedSearchQuery); window.location.href = duckDuckGoUrl; } else { window.location.href = 'https://duckduckgo.com/'; } })();
@cocoabox
cocoabox / steal-synopsis-from-amazon-prime-video.js
Created January 11, 2023 16:37
steal-synopsis-from-amazon-prime-video.js
(async function(){
const series_title = document.querySelector('[data-automation-id="title"]')?.innerText.trim();
const series_synop = document.querySelector('[data-automation-id="atf-synopsis"]')?.innerText.trim();
const li_arr = document.querySelectorAll('[id^="av-ep-episodes"]');
let episodes = [];
for (const li of li_arr) {
const title_elem = li.querySelector('[data-automation-id^="ep-title-episodes-"]');
const title_all = title_elem.innerText.trim();
const title_mat = title_all.match(/^([0-9]+)\.*\s*(.*)$/);
@cocoabox
cocoabox / youtube-audio.sh
Last active September 12, 2022 05:31
Download youtube music videos or playlist (with static album art) into m4a file with embedded album art. Requires ffmpeg, AtomicParsley, yt-dlp
#!/bin/bash
if [[ -z "$1" ]]; then
echo "usage : $0 [YOUTUBE_URL_OR_ID]" >&2
exit 1
fi
OK=1
ffmpeg >/dev/null 2>/dev/null
if [[ $? -eq 127 ]]; then
echo "ffmpeg is required : https://ffmpeg.org/download.html" >&2
@cocoabox
cocoabox / twitter-not-interested-bookmarklet.js
Created May 5, 2022 15:37
twitter-not-interested-bookmarklet.js
javascript: void((function() { function disableInterests(doc) { function findSpanText(checkbox) { let elem = checkbox.parentElement; let levels = 0; while (elem && levels < 10) { let span = elem.querySelector('span'); if (span) { return span.textContent; } elem = elem.parentElement; levels++; } } let wait_ms = 100; let checkboxes = doc.querySelectorAll("div > input[type='checkbox']:checked"); let len = checkboxes.length; let done = 0; let inc = 50; checkboxes.forEach((interest) => { console.log(interest); let text = findSpanText(interest); setTimeout(function() { done++; let msg = `(${done}/${len}) ` + (text ? text : '(unknown)'); console.log(msg); doc.title = msg; interest.scrollInt
@cocoabox
cocoabox / fetlife-convert-all-photos-to-private.js
Last active July 12, 2020 10:36
batch convert all FetLife photos to private
// fetLife batch change all photos to private ("friends only")
//
// usage:
//
// 1. open your first photo , URL should be https://fetlife.com/users/xxxxx/pictures/yyyyy
// 2. copy paste this code to your Javascript console and hit Return
// - a new tab (window) will open; do not close this tab
// - to terminate the process, close the newly-opened tab, then reload the current window/tab
// 3. this script doesn't work all the time; to make sure every pic is now private, repeat 1~2 again
//
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
ATV="$DIR/atv"
ATV_URL="$DIR/atv-airplay-url"
TMP_DIR="/tmp/play-$RANDOM"
HTTP_SERVER="/usr/local/bin/http-server"
NPM="/usr/local/bin/npm"
if [[ ! -f "$1" ]]; then
javascript:void(function(){function e(e){let i="",o="",t="";return e>3600&&(e-=3600*(i=Math.floor(e/3600)),i=`${i} hrs`),e>60&&(e-=60*(o=Math.floor(e/60)),o=`${o} min`),e&&(t=`${e} sec`),[i,o,t].join(" ").trim()}function i(){window.__close_timer.timer&&window.clearInterval(window.__close_timer.timer),window.__close_timer.timer="",window.__close_timer.active=!1,window.__close_timer.sec=0,window.__close_timer.title=""}if(void 0===window.__close_timer&&(window.__close_timer={}),window.__close_timer.active){let o=e(window.__close_timer.sec);return window.confirm(`%E2%8F%B2 :${o}\n%F0%9F%9A%AB%E2%8F%B2?`)?(document.title=window.__close_timer.title,void i()):void 0}let o="10m",t=document.querySelector("video");if(t){o=e(Math.floor(t.duration-t.currentTime)+5)}let _=window.prompt("%E2%8F%B2%F0%9F%92%A4 %E2%86%92%E2%9D%8C",o).trim();if(!_)return;let r=_.toLowerCase().match(/^(([0-9\.]+)\s*(hours|hour|hrs|hr|h))?\s*(([0-9\.]+)\s*(minute|minute|mins|min|m))?\s*(([0-9\.]+)\s*(seconds|second|secs|sec|s))?$/),n=0;r[2]&&(n
@cocoabox
cocoabox / close-timer.js
Last active April 4, 2020 10:14
close timer bookmarklet
void(function(){
function sec2time_str(sec) {
let h='';
let m='';
let s='';
if (sec > 3600) {
h = Math.floor(sec / 3600);
sec -= 3600*h;
h = `${h} hrs`;
}