Skip to content

Instantly share code, notes, and snippets.

View dubiouscript's full-sized avatar

dubiouscript

  • ./
View GitHub Profile
@dubiouscript
dubiouscript / bash_pager.sh
Last active December 9, 2022 10:18 — forked from SomeCrazyGuy/bash_pager.sh
A pager written entirely using bash 4 builtins, relies on no other system binaries.
#!/bin/bash --noprofile
# DO ALMOST ANYTHING PUBLIC LICENSE
# Everyone is permitted to copy and distribute verbatim or modified
# copies of this code for any purpose as long as any "Credit"
# lines are not removed.
#Credit: /u/linuxversion
# add pipes : https://old.reddit.com/r/commandline/comments/4ct8px/i_wrote_a_pager_purely_in_bash_using_just_bash/d1lyq9q/
#<your Credit line here, if you want>
@dubiouscript
dubiouscript / call_graph.awk
Created December 17, 2021 07:51 — forked from tylerneylon/call_graph.awk
Parse Lua code and draw its call graph.
#!/usr/bin/awk -f
#
# call_graph.awk
#
# Usage:
# ./call_graph.awk my_program.lua | dot -Tpng > call_graph.png
#
# This is a script that generates a visual call graph
# for a Lua file. This script only shows calls made
# to functions defined within the input Lua file; that is,
@dubiouscript
dubiouscript / dabblet.css
Created July 5, 2019 14:42 — forked from GeorgeTzellis/dabblet.css
HTML source viewer
/* HTML source viewer */
body { margin: 3em;}
::before { content: open-quote '>'; }
[id]::before { content: open-quote ' id="'attr(id) '">'; }
[class]::before { content: open-quote ' class="'attr(class)'">'; }
[id][class]::before { content: open-quote ' id="'attr(id)'" class="'attr(class)'">'; }
::after { content: close-quote ; }
html::before, html::after,
body::before, body::after {
/*\
title: $:/plugins/jayfresh/tiddler-server/tiddler-server.js
type: application/javascript
module-type: command
A server command to serve tiddlers as HTML as well as the main server API
\*/
(function(){
@dubiouscript
dubiouscript / mime.sh
Created June 10, 2019 16:00 — forked from markusfisch/mime.sh
bash functions to dump and inspect a message in MIME format
#!/usr/bin/env bash
##############################################################################
#### MIME interface
##############################################################################
# Parse message in MIME format and create a temporary cache directory
mime_parse()
{
MIME_CACHE=${MIME_CACHE:-`mktemp -d ${BIN}.XXXXXXXXXX`}
@dubiouscript
dubiouscript / web-servers.md
Created June 3, 2019 10:56 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@dubiouscript
dubiouscript / tw5-server.rb
Created May 26, 2019 15:12 — forked from jimfoltz/tw5-server.rb
A local server for TiddlyWiki5 that allows saving wiki.
require 'webrick'
require 'fileutils'
if ARGV.length != 0
root = ARGV.first.gsub('\\', '/')
else
root = '.'
end
BACKUP_DIR = 'bak'
@dubiouscript
dubiouscript / category-theory-study-materials.org
Created April 15, 2019 11:17 — forked from mbbx6spp/category-theory-study-materials.org
List of books/lecture series/courses/conference talks and practices used to learn about category theory, functional programming, and dependent types by a software developer in industry who has limited time to do this stuff with some suggestions on how to consume the material.

Category Theory and Functional Programming Study Materials

Acronyms/Terms

  • CT: Category Theory
  • FP: Functional Programming (typically meaning more pure functional programming)
  • TFP: Total Functional Programming
  • TDD: Type Driven Development (e.g. via Idris or Agda)
  • TT: Type Theory
  • PLT: Programming Language Theory
@dubiouscript
dubiouscript / server
Created February 22, 2019 15:17 — forked from mbbx6spp/server
ZOMG a bash powers HTTP web service that runs via the `socat` web app container like so: socat TCP4-LISTEN:8080 EXEC:/path/to/server/script
#!/usr/bin/env bash
# Purpose: Provide HTTP server that displays the current server date to
# validate the artifact structure and play with.
declare -a _http_responses=(
[200]="OK"
[201]="Created"
[202]="Accepted"
[204]="No Content"
[301]="Moved Permanently"
#!/usr/bin/env bash
# HTTP web service implemented in socat + bash
# Usage: socat -T 1 -d -d tcp-l:8080,reuseaddr,fork,crlf exec:./server
# Purpose: Provide an HTTP server that displays the current server date,
# to validate the artifact structure and play with it.
# Note: socat crlf option is translating all our \n to \r\n on output.
http_version="1.0"
declare -a _http_responses=(