Skip to content

Instantly share code, notes, and snippets.

@dubiouscript
Last active July 1, 2019 22:30
Show Gist options
  • Save dubiouscript/6c82fab69c731647bfe4d60231b90161 to your computer and use it in GitHub Desktop.
Save dubiouscript/6c82fab69c731647bfe4d60231b90161 to your computer and use it in GitHub Desktop.
Internet Information BS (bash services;-)
# https://gist.github.com/dubiouscript/6c82fab69c731647bfe4d60231b90161
# https://georgik.rocks/cgi-server-bash-one-liner/#gzip
#
# get_request_header "Accept-Encoding" | grep -q -e "gzip" && set_response_header "Content-encoding" "gzip";
#
# encodeing_gzip() { get_request_header "Accept-Encoding"| grep -q -e "gzip" ; [ $? -eq 0 ] && gzip || cat ; }
#
# serve_file() {
# local file="$( realpath $1)"; # works with links
# ...
# cat "$file" | encodeing_gzip
# wait 0.5
# fi
#}
########
# tw5
tw5=https://tiddlywiki.com/empty.html
# tw5pre
tw5pre=https://tiddlywiki.com/prerelease/empty.html
# twclasic
twclasic=https://classic.tiddlywiki.com/empty.html
[ -z $(which socat) ] && { echo " socat not found !" ; }
wdir=~/bin; # or where ever
cd $wdir
svr=bashttpd
[ -f ./$svr ] || wget https://github.com/TooTallNate/bashttpd/raw/master/bashttpd
svr_cfg=bashttpd.conf
[ -f ./$svr_cfg ] || wget https://github.com/TooTallNate/bashttpd/raw/master/bashttpd.conf
tw_svr_cfg=bashttpd-tw.conf
[ -f ./$tw_svr_cfg ] || cp ./bashttpd.conf ./$tw_svr_cfg && { echo "
# svr dir init
wdir=~/svr/tw
[ -d $wdir ] || mkdir -p $wdir ;
dint() { [ -d $1 ] || mkdir -p $1 ; }
# tw init
[ $wdir/empty.html ] || wget -P $wdir https://tiddlywiki.com/empty.html && ln -s ./empty.html ./latest
## tiddly bash server uri path / actions
#
# on_uri_match '^/$' serve_file $wdir/latest
# on_uri_match '^/tw$' serve_file $wdir/latest
# on_uri_match '^/tiddlywiki$' serve_file $wdir/latest
##
#############
# termz
##########################
## cli - test
# https://pypi.org/project/pyxtermjs/
# https://github.com/tsl0922/ttyd
## 00)
# https://github.com/unilogue/termlib
## 01)
# https://xtermjs.org/
# https://cdnjs.com/libraries/xterm
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/addons/zmodem/zmodem.min.js.map
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.css
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.js
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.js.map
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.min.css
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.min.css.map
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.min.js
# https://cdnjs.cloudflare.com/ajax/libs/xterm/3.13.2/xterm.min.js.map
# https://github.com/xtermjs/xterm.js
# https://medium.com/@jkinkead/in-browser-demoswith-xterm-reveal-js-d16ae3cb710a
# https://github.com/jkinkead/reveal.js/blob/xterm_base/README-xterm.md
## Xterm.js 1.1 – Full in-browser terminal with IME support and physical scrolling
# https://news.ycombinator.com/item?id=12337743
# https://xtermjs.org/blog/articles/2017-03-08-xtermjs-2.4
## TIP: You can even register multiple link matchers and assign priorities.
# https://github.com/xtermjs/xterm.js/pull/577
# https://stackoverflow.com/questions/15035786/download-source-from-npm-without-installing-it
# https://registry.npmjs.org/xterm
# https://registry.npmjs.org/xterm/-/xterm-3.13.2.tgz
# search =: tiddlywiki plugin include js
# https://web.archive.org/web/20170728212414/http://larigot.avarts.ionio.gr/users/iani/wikis/tw5square.html#Loading%20external%20JavaScript%20scripts%20in%20TW
## Simple Javascript insertion in tiddlers (text/vnd.tiddlywiki)
# https://groups.google.com/forum/#!msg/tiddlywiki/NwOI-QER2ig/lSLS3XolwDoJ
## in TW5, there is a strict distinction between wiki text tiddlers (text/vnd.tiddlywiki)
## and JavaScript module tiddlers (type text/javascript, and with a module-type field).
## That allows us to filter content from other sources to ensure that we don't allow executable code.
# https://tiddlywiki.com/static/PluginMechanism.html
## Add third-party plugins to the plugin library
# https://github.com/Jermolene/TiddlyWiki5/issues/1696
# https://github.com/topics/tiddlywiki-plugin
# https://stackoverflow.com/questions/tagged/tiddlywiki
# https://www.reddit.com/r/TiddlyWiki5/wiki/pluginsandresources
# https://news.ycombinator.com/item?id=17002648# Show HN: ~200 byte in-browser, no JS, private notepad
" ; } ; # ./bashttpd-tw.conf
# set config var
# run socat svr
BASHTTPD_CONFIG=./$tw_svr_cfg socat -vvv TCP-LISTEN:54321,bind=127.0.0.1,reuseaddr,fork EXEC:./$svr ;
# https://www.youtube.com/watch?v=qAkZT_4vL_Y # what?
# https://www.youtube.com/watch?v=ppWzTpQIN_U # ?tahw
# https://tiddlywiki.com/#Editions
# https://tiddlywiki.com/empty.html
## clasic
# https://classic.tiddlywiki.com/empty.html
# https://classic.tiddlywiki.com/empty.zip
# https://github.com/TiddlyWiki/TiddlyWiki/releases
# https://github.com/TiddlyWiki/TiddlyWiki/releases/download/v2.9.2/empty_TW_2.9.2.html
## TW 2.9.2 release: finally! + some thoughts about a roadmap
# https://groups.google.com/forum/#!topic/tiddlywikiclassic/GDBYezPtdlg
# https://github.com/nasoym/websocket_bash
## php
# https://github.com/YakovL/MainTiddlyServer
## ruby
# https://gist.github.com/jimfoltz/ee791c1bdd30ce137bc23cce826096da
## go
# https://gitlab.com/opennota/widdly
## node
# https://github.com/Arlen22/TiddlyServer
# wtf
# https://github.com/perlguy/luakit-tiddlywiki
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment