OcttKB Cross-Repo Sync (HTML to Raw)

This commit is contained in:
octospacc 2023-11-09 00:18:54 +00:00
parent 861a2468b0
commit c952d967a6
15 changed files with 62 additions and 26 deletions

View File

@ -1,6 +1,6 @@
created: 20230221204801305
creator: Octt
modified: 20230901234757906
modified: 20231109000404934
modifier: Octt
tags:
title: Web/Development
@ -40,7 +40,6 @@ title: Web/Development
!!!! Minification
* ~~[[node-minify|https://github.com/srod/node-minify]] - //Light Node.js module and CLI app that compress javascript, css and html files//~~
* [[UglifyJS|https://lisperator.net/uglifyjs/]] - //JavaScript parser / mangler / compressor / beautifier// - <<[ "[[Git|https://github.com/mishoo/UglifyJS]]">>
!!! ''Misc''

View File

@ -1,6 +1,6 @@
created: 20231106001643166
creator: Octt
modified: 20231106001854973
modified: 20231109001715928
modifier: Octt
tags:
title: Archive
@ -8,3 +8,7 @@ title: Archive
<<^wikipediaframe Archive>>
* <<httpsL hobune.stream>> --- //hobune.stream is a website for me to share my private archives publicly with the world//, seems to be all videos, and many of them
<<^wikipediaframe "Archive file">>
* [[Forgot password to 7-Zip archive, programs to crack it?|https://security.stackexchange.com/questions/51900/forgot-password-to-7-zip-archive#51908]]

View File

@ -1,6 +1,6 @@
created: 20231029134919585
creator: Octt
modified: 20231107231816657
modified: 20231109001417793
modifier: Octt
tags:
title: C Language
@ -20,6 +20,7 @@ title: C Language
* [[strcpy vs. memcpy|https://stackoverflow.com/questions/2898364/strcpy-vs-memcpy]] --- //strcpy stops when it encounters a NUL ('\0') character, memcpy does not//, aka as the names suggest often strcpy is perfect for strings while for generic data memcpy could be needed.
* [[ISO C90 forbids mixed declarations and code in C|https://stackoverflow.com/questions/13291353/iso-c90-forbids-mixed-declarations-and-code-in-c]] --- old C standards required that new variables can be declared only before any other actual instruction in a scoped block, e.g. only at the top of a function
* [["Multiple definition", "first defined here" errors|https://stackoverflow.com/questions/30821356/multiple-definition-first-defined-here-errors]] --- error that can arise in multiple cases
* [[Creating empty function macros|https://stackoverflow.com/questions/9187628/empty-function-macros]] --- only safe way is `#define SomeFunction(arg) ((void)0)`
** [[C macros, what's the meaning of ((void)0)?|https://stackoverflow.com/questions/61157541/c-macros-whats-the-meaning-of-void0]]

View File

@ -1,6 +1,6 @@
created: 20230613185754543
creator: Octt
modified: 20231106003605886
modified: 20231109001107345
modifier: Octt
tags:
title: Development
@ -11,6 +11,8 @@ title: Development
* <<RedditL r/webdev/comments/spr2db/confused_about_web_app_architecture_and/ "Confused about web app architecture and separation of frontend and backend">>
* [[What package naming convention do you use for personal/hobby projects|https://stackoverflow.com/questions/292169/what-package-naming-convention-do-you-use-for-personal-hobby-projects-in-java]] in Java/Android/Flatpak?
* [[Why would a game developer write their own engine instead of using existing ones?|https://gamedev.stackexchange.com/questions/74388/why-would-a-game-developer-write-their-own-engine-instead-of-using-existing-ones]]
** <<RedditL r/gamedev/comments/91u7ia/is_it_worth_my_time_in_2018_to_make_a_game_using "Is it worth my time in 2018 to make a game using only C and SDL?">>
* [[Compilation and Installation using Autoconf|https://opensource.apple.com/source/X11libs/X11libs-60/mesa/Mesa-7.8.2/docs/autoconf.html]]
* [[What is the purpose of .PHONY in a Makefile?|https://stackoverflow.com/questions/2145590/what-is-the-purpose-of-phony-in-a-makefile]] --- TLDR: it's to declare "fake" targets that must build independently from actual files on disk (that make would otherwise use as targets), it doesn't mean "sound" or "pronunciation" or otherwise the full list of only allowed build targets, as I initially thought because of associating phony => telephony => ...

View File

@ -1,12 +1,14 @@
created: 20230724220345827
creator: Octt
modified: 20230926085423503
modified: 20231109000746810
modifier: Octt
tags: Text
title: Font
<<^wikipediaframe Font>>
* [[Good bitmap fonts with big sizes and unicode support?|https://superuser.com/questions/401831/good-bitmap-fonts-with-big-sizes-and-unicode-support#473798]]
Interesting fonts, for specific uses:
* <<WikipediaLink "Blackboard bold">>
@ -15,3 +17,4 @@ Interesting fonts, for specific uses:
Good fonts, for multiple uses:
* <<linkdesc epto-fonts "https://github.com/epto/epto-fonts" "Free bitmap (8x8, 8x16, 8xY) fonts by EPTO">>
* <<linkdesc "UW ttyp0" "https://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/" "Monospace Bitmap Screen Fonts for X11">> <!-- "https://people.mpi-inf.mpg.de/~uwe/misc/uw-ttyp0/ttyp0-8x16.png" -->

View File

@ -1,6 +1,6 @@
created: 20221110145611678
creator: Octt
modified: 20231107213800379
modified: 20231109000419620
modifier: Octt
tags: Development $:/i18n:en Web
title: JavaScript
@ -24,6 +24,7 @@ title: JavaScript
* [[Fastest method to escape HTML tags as HTML entities?|https://stackoverflow.com/questions/5499078/fastest-method-to-escape-html-tags-as-html-entities]] --- in the browser, `(html) => { var escape = document.createElement('textarea'); escape.textContent = html; return escape.innerHTML; }`
* [[Get a random item from a JavaScript array|https://stackoverflow.com/questions/5915096/get-a-random-item-from-a-javascript-array#5915122]] --- `item = items[Math.floor(Math.random() * items.length)];`
* [[How to get text from all descendents of an element (disregarding scripts)?|https://stackoverflow.com/questions/2532043/how-to-get-text-from-all-descendents-of-an-element-disregarding-scripts]]
* [[Simplest code for array intersection in javascript|https://stackoverflow.com/questions/1885557/simplest-code-for-array-intersection-in-javascript#1885569]] --- `arrayNew = array1.filter(value => array2.includes(value));`
* [[Array.prototype.splice()|https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice]], [[JavaScript Array splice() (W3S)|https://www.w3schools.com/jsref/jsref_splice.asp]] --- //changes the contents of an array by removing or replacing existing elements and/or adding new elements in place//
* <<MDNLink Web/JavaScript/Reference/Global_Objects/Array/concat "Array.prototype.concat()">> --- //used to merge two or more arrays, does not change the existing arrays but instead returns a new one//
@ -35,4 +36,7 @@ title: JavaScript
* [[jsPerf|https://jsperf.app/]] - //online JavaScript performance benchmark// - <<[ "[[Git|https://github.com/rd13/jsperf.app]]">>
** Old source code: [[v2|https://github.com/jsperf]], [[v1|https://github.com/mathiasbynens/jsperf.com]]
* [[MeasureThat.net|https://www.measurethat.net/]] - //measure performance of JavaScript code// - <<[ "[[Git|https://github.com/thecoderok/MeasureThat.net]]">>
* [[UglifyJS|https://lisperator.net/uglifyjs/]] - //JavaScript parser / mangler / compressor / beautifier// - <<[ "[[Git|https://github.com/mishoo/UglifyJS]]">>
** <<linkdescgit "UglifyJS 3: Online JavaScript minifier" "https://skalman.github.io/UglifyJS-online/" "JavaScript minifier in the browser" "https://github.com/Skalman/UglifyJS-online">>
* <<linkdescgit de4js "https://lelinhtinh.github.io/de4js" "JavaScript Deobfuscator and Unpacker" "https://github.com/lelinhtinh/de4js">>

View File

@ -1,6 +1,6 @@
created: 20230216193546517
creator: Octt
modified: 20231105202624812
modified: 20231108232502096
modifier: Octt
tags:
title: Language
@ -21,4 +21,5 @@ title: Language
; Tools
: Machine translation: <<httpsL DeepL.com>> | <<httpsL Translate.Google.com>>
:* <<linkdescgit "Lingva Translate" "https://lingva.ml" "Self-hostable alternative front-end and API for Google Translate" "https://github.com/TheDavidDelta/lingva-translate">> <<[# "Scraper Git" "https://github.com/thedaviddelta/lingva-scraper">>
:* <<linkdescgit "Lingva Translate" "https://lingva.ml" "Self-hostable alternative front-end and API for Google Translate" "https://github.com/TheDavidDelta/lingva-translate">> <<[# "Scraper Git" "https://github.com/thedaviddelta/lingva-scraper">> --- note: the official instance appears broken, returning error for translations with specific characters, and also less metadata from the API, problems that some other public instances don't have (official may be running an older version?)
:* <<linkdesc Mozhi"https://codeberg.org/aryak/mozhi" "alternative-frontend for many translation engines">> <<[# "Scraper Git" "https://codeberg.org/aryak/libmozhi">> (Google support broken as of 2023/11)

View File

@ -1,7 +1,7 @@
created: 20230111153758951
creator: Octt
icon: 🐧
modified: 20231106235715753
modified: 20231109000427097
modifier: Octt
page-cover: https://images.unsplash.com/photo-1549605659-32d82da3a059?ixlib=rb-4.0.3&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D
tags: $:/i18n:en Unix
@ -27,6 +27,7 @@ title: Linux
* [[SquashFS|https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html]], [[DwarFS|https://github.com/mhx/dwarfs]]
* cannot access fuse mount as root or other users, [[Why does root get Permission denied when accessing FUSE directory?|https://unix.stackexchange.com/questions/17402/why-does-root-get-permission-denied-when-accessing-fuse-directory#17423]] --- To allow access to other users, add `user_allow_other` in `/etc/fuse.conf`, then mount fs with `-o allow_root` (only root) or `-o allow_other` (any user, including root).
* [[How to extend the life of SD card used as root partition?|https://raspberrypi.stackexchange.com/questions/169/how-can-i-extend-the-life-of-my-sd-card]]
* [[systemd-nspawn|https://wiki.archlinux.org/title/Systemd-nspawn]] --- //chroot on steroids// for systemd hosts and guests.
** Quick boot a mounted rootfs: `-b -D ${rootfs path}`.

View File

@ -0,0 +1,10 @@
created: 20231109001128123
creator: Octt
modified: 20231109001309140
modifier: Octt
tags:
title: Lua
<<^wikipediaframe "Lua programming language">>
* [[How to add your C Library in Lua|https://blog.devgenius.io/how-to-add-your-c-library-in-lua-46fd246f0fa8?gi=02fe4ab99feb]]

View File

@ -0,0 +1,8 @@
created: 20231108230902146
creator: Octt
modified: 20231108231740168
modifier: Octt
tags:
title: Retrodevelopment
* <<linkdescgit 8bitworkshop "https://8bitworkshop.com/" "web-based IDE for 8-bit programming and Verilog development" "https://github.com/sehugg/8bitworkshop">>

View File

@ -1,12 +1,16 @@
created: 20231105210128175
creator: Octt
list-after: $:/core/ui/ViewTemplate/tags
modified: 20231107223701057
modified: 20231108163056575
modifier: Octt
tags: $:/tags/ViewTemplate
title: $:/Styles/View/i18n
\define OcttKB-i18n()
<<script script='
!function(){var e,t,n,r,o={},a="object"==typeof module&&"object"==typeof module.exports,i="undefined"!=typeof window&&void 0!==window.document,s={lingva:["google"],mozhi:["deepl","duckduckgo","mymemory","reverso","watson","yandex"]};function l(e,t,n=[]){var r=0;return function e(t,n,o){for(var a,i,s=[],l=0,u=t.childNodes.length;l<u;l++){var d=t.childNodes[l];1!==d.nodeType||(i=void 0,(a="notranslate").getAttribute&&a.getAttribute("class").toLowerCase().replace(/\t/g," ").split(" ").includes(i))||n.excludeTags.includes(d.tagName.toLowerCase())?3===d.nodeType&&""!==d.data.trim()&&(o.length>0&&(d.data=o[r]),s.push(d.data),r++):(n.includeAttrs.forEach(function(e){var t=d.getAttribute(e);t&&(o.length>0&&d.setAttribute(e,o[r]),s.push(t),r++)}),s=s.concat(e(d,n,o)))}return s}(e,t,n)}a&&!i&&(n=require("jsdom").JSDOM,r=require("sync-request"),e=(e=>new n(e).window.document),t=(e=>{var t=r("GET",e);return{response:t,text:t.getBody("utf8")}})),i&&(e=function(e){return(new DOMParser).parseFromString(e,"text/html")},t=function(e){var t=new XMLHttpRequest;return t.open("GET",e,!1),t.send(),{response:t,text:t.responseText}}),o.TranslateHtml=function(n,r,o={}){o.languageFrom||(o.languageFrom="auto"),o.instances||(o.instances=[{type:"Lingva",url:"https://lingva.garudalinux.org",cors:!0},{type:"Lingva",url:"https://lingva.lunar.icu",cors:!0},{type:"Mozhi",url:"https://translate.projectsegfau.lt",cors:!1},{type:"Mozhi",url:"https://mozhi.aryak.me",cors:!1},{type:"Mozhi",url:"https://translate.bus-hit.me",cors:!1}]),o.engines||(o.engines=["DeepL","DuckDuckGo","Google"]),o.maxFragmentSize||(o.maxFragmentSize=900),o.endsOfSentence||(o.endsOfSentence=[".",":",";","!","?"]),o.excludeTags||(o.excludeTags=["script","style"]),o.includeAttrs||(o.includeAttrs=["title","alt"]);for(var a=e(n),i=l(a,o),u="";i.join("").includes(u);)u+=Math.random().toString().slice(-1)[0];u=`{ ${u} }`;for(var d=i.join(u),c="",g=[""],p=0,m=0;m<d.length;m++){var h=g.length-1;g[h]+=d[m];var f=g[h].length>=o.maxFragmentSize,v=o.endsOfSentence.includes(d[m])&&d[m]!==d[m+1];v&&!f?p=g[h].length:v&&f&&(g.push(""),g[h+1]=g[h].slice(p),g[h]=g[h].slice(0,p))}var y,w,x={},M=0,S=o.instances[Math.floor(Math.random()*o.instances.length)],T=S.type.toLowerCase();o.engines=o.engines.filter(function(e){return-1!==s[T].indexOf(e.toLowerCase())});var z=o.engines[Math.floor(Math.random()*o.engines.length)].toLowerCase();"lingva"===T?w=`${S.url}/api/v1/${o.languageFrom}/${r}/`:"mozhi"===T&&(w=`${S.url}/api/translate?engine=${z}&from=${o.languageFrom}&to=${r}&text=`);for(m=0;m<g.length;m++){var L;try{x=JSON.parse(t(`${w}${encodeURIComponent(g[m])}`).text),"lingva"===T?(y=x.translation,x.info.detectedSource):"mozhi"===T&&(y=x["translated-text"],x.detected)}catch(e){M++,L=e}if(y||M++,M>0){if(M>=3&&M%3==0)return{error:L};if(M>=9)return{error:L};m--}else c+=y+" ",M=0}return l(a,o,c.split(u)),{instance:S,engine:z,html:a.documentElement.outerHTML}},"object"==typeof module&&"object"==typeof module.exports&&(module.exports=o),"undefined"!=typeof window&&void 0!==window.document&&(window.TiddlyCoso_i18n=o)}();
'>>
<<script script="try{
var BodySplitter = '</p>>';
var TidTitle = this.variables.thisTiddler.value;
@ -22,26 +26,25 @@ title: $:/Styles/View/i18n
this.parentDomNode.appendChild(input);
var btn = document.createElement('button');
btn.innerHTML = 'Translate [Beta]';
/* TODO: make this not lock up the main thread */
btn.onclick = function(){
/* var TidLangGuessed; */
var TidBodyEl = TidFrame.querySelector('.tc-tiddler-body');
var TidBody = TidBodyEl.innerHTML;
var TidBodyParags = TidBody.trim().replaceAll('>', '>>').split(BodySplitter);
var TidBody = TidBodyEl.innerHTML.trim();
/* var TidBodyParags = TidBody.trim().replaceAll('>', '>>').split(BodySplitter); */
var TidBodyTranslated = '';
/* TODO: should probably fix the splitting to make it do longer segments, otherwise translations are more likely broken, and also find a good way to avoid the occasional translating of HTML elements; we should ideally do like the GTranslate embeddable script and parse the doctree to translate only the innerHTML strings */
for (var i=0; i<TidBodyParags.length; i++) {
/* for (var i=0; i<TidBodyParags.length; i++) {
if (TidBodyParags[i].trim()) {
/* TODO: make this not lock up the main thread */
var req = new XMLHttpRequest();
req.open('GET', `https://lingva.garudalinux.org/api/v1/${TidLangKnown ? TidLangKnown : 'auto'}/${input.value}/${encodeURIComponent(TidBodyParags[i].trim())}`, false);
req.send();
var jsonResponse = JSON.parse(req.responseText);
TidBodyTranslated += jsonResponse.translation + BodySplitter;
/* TidLangGuessed = jsonResponse.info.detectedSource; */
}
}
} */
var TransBodyEl = document.createElement('div');
TransBodyEl.innerHTML += TidBodyTranslated.replaceAll('>>', '>');
TransBodyEl.innerHTML = TiddlyCoso_i18n.TranslateHtml(TidBody, input.value).html;
/* TransBodyEl.innerHTML += TidBodyTranslated.replaceAll('>>', '>'); */
TidFrame.appendChild(TransBodyEl);
TidBodyEl.style.display = 'none';
btn.style.display = 'none';

View File

@ -1,5 +1,5 @@
created: 20231107235931509
created: 20231109001848247
current-tiddler: GettingStarted
modified: 20231107235931509
modified: 20231109001848247
title: $:/HistoryList
type: application/json

View File

@ -1,6 +1,6 @@
created: 20231107154729277
created: 20231108204045939
creator: Octt
list:
modified: 20231107235831913
modified: 20231109001537817
modifier: Octt
title: $:/StoryList

View File

@ -1,7 +1,7 @@
created: 20220920140732083
creator: Octt
modified: 20231107220742227
modified: 20231108234957601
modifier: Octt
title: $:/state/showeditpreview
no
yes

View File

@ -1,6 +1,6 @@
created: 20220920092307479
creator: Octt
modified: 20231107235848696
modified: 20231109001815979
modifier: Octt
title: $:/state/tab/sidebar--595412856