Skip to content

Instantly share code, notes, and snippets.

View eschen42's full-sized avatar

Arthur Eschenlauer eschen42

View GitHub Profile
@eschen42
eschen42 / tabCount.icn
Last active December 29, 2021 16:57
Count tabs per line; flag when number differs from number in first line
# Count tabs per line; flag when number differs from number in first line
#
# Execute with `icon tabCount.icn tsv_file -1`
# See [the Icon website](https://cs.arizona.edu/icon) for further info about the Icon programming language.
#
procedure main(args)
# args[1] = input file
# args[2] = number of lines (optional, default = 3)
local expected
local input_file
@eschen42
eschen42 / LcomboP.icn
Last active September 24, 2021 13:50
Produce lists combining memoized infinte sequences
############################################################################
#
# File: LcomboP.icn
#
# Subject: Produce lists combining memoized infinte sequences
#
# Author: Art Eschenlauer (@eschen42 on GitHub,
# - https://orcid.org/0000-0002-2882-0508
# - https://github.com/eschen42
#
@eschen42
eschen42 / coexpr.h
Last active August 5, 2021 17:04
Macros to declare C coroutines with syntax similar to Icon co-expressions
#ifndef _COEXPR_H
// Here are C macros to approximate Icon co-expressions, see e.g.,
// https://web.archive.org/web/20160407082917im_/http://www.cs.arizona.edu/icon/ftp/doc/tr87_6.pdf
// https://web.archive.org/web/20160407001546im_/http://www.cs.arizona.edu/icon/analyst/backiss/IA21.pdf
// These macros were (loosely) adapted from:
// https://web.archive.org/web/20210611030357im_/https://www.chiark.greenend.org.uk/~sgtatham/coroutine.h
// see e.g.,
// https://web.archive.org/web/20210611030357im_/https://www.chiark.greenend.org.uk/~sgtatham/coroutines.html
@eschen42
eschen42 / Dockerfile.icon-cbuilder
Last active August 3, 2021 21:58
icon-cbuilder Dockerfile
# Dockerfile to build icon without graphics, producing
# - statically and dynamically linked iconx
# - statically linked icont
# Note that the dynamic linking is linked:
# - to musl https://musl.libc.org/
# - rather than glibc https://www.gnu.org/software/libc/
FROM eschen42/alpine-cbuilder:release-v3.14.0
# Note that this image does not /usr/include/X11/Xlib.h, so:
# - `make Configure` rather than `make X-Configure`
# - do not copy the graphics content from IPL
@eschen42
eschen42 / readme.txt
Created July 20, 2021 18:46 — forked from krisalyssa/readme.txt
Ubuntu 20.10 + WSL 2 + XRDP PulseAudio
# Credits
# https://c-nergy.be/blog/?p=13655
# https://askubuntu.com/questions/844245/how-to-compile-latest-pulseaudio-with-webrtc-in-ubuntu-16-04
# https://askubuntu.com/questions/496549/error-you-must-put-some-source-uris-in-your-sources-list
# https://unix.stackexchange.com/questions/65167/enable-udev-and-speex-support-for-pulseaudio
# https://rudd-o.com/linux-and-free-software/how-to-make-pulseaudio-run-once-at-boot-for-all-your-users
# https://gist.github.com/rkttu/35ecab5604c9ddc356b0af4644d5a226
# First, you should install XRDP and X11 Desktop Environment first.
@eschen42
eschen42 / Table.js
Last active August 31, 2020 15:06
A simple associative table for JavaScript
// Table - A simple associative table for JavaScript
// methods:
// - size:integer - number of members in the table
// - keys:Array - the keys used to look up values in the Table
// - values:Array - the values in the table in a numbered array
// TODO:
// - add slicing
// - add delete-by-key
function Table() {
var t = Object.create(Table.methods)
@eschen42
eschen42 / .gitattributes
Last active May 7, 2020 17:26
utf16letoutf8.icn - An Icon tool to convert UTF-16LE to UTF-8
# ref: https://help.github.com/en/github/using-git/configuring-git-to-handle-line-endings#per-repository-settings
# Files that are truly binary and should not be modified.
#eg# *.png binary
donne.utf16le text working-tree-encoding=UTF-16 eol=CRLF
# Files to be normalized and converted to native line endings on checkout.
#eg# *.c text
# Files that will always have CRLF line endings on checkout.
#eg# *.sln text eol=crlf
@eschen42
eschen42 / README.md
Last active February 20, 2025 21:26
annucode.icn - A tool to annotate Icon and Unicon ucode files
@eschen42
eschen42 / FileCopyStatsExtract.cmd
Created March 8, 2020 20:29
Windows "here document" as a FileCopy stats extractor
@set ERRORLEVEL=&setlocal&echo off
if not defined SED_EXE set SED_EXE=sed.exe
set ARG1=%~dpnx1
if defined ARG1 (
if exist "%ARG1%" (
call :sed_here "%~dpnx1"
exit /b %ERRORLEVEL%
)
)
@eschen42
eschen42 / hash_relative.cmd
Created February 18, 2020 13:24
powershell commandlet based MD5 hashing - much slower than FCIV
setlocal
set DASH_R=TRUE
set BASE_PATH=%CD%\
set BASE_PATH=%BASE_PATH::=.%
set BASE_PATH=%BASE_PATH:\=.%
if %DASH_R% == FALSE powershell -Command "Get-FileHash -Algorithm MD5 -Path %1\* | Sort-Object Path | Select-Object -Property Hash,Path | Out-String -Stream" | sed -e "/^Hash/d; /^---/d; /^$/d; s/%BASE_PATH%//"
if %DASH_R% == TRUE for /f "delims=" %%D in ('dir/on/s/ad-h/b %1 ^| grep -v "[\][.]"') do @powershell -Command "Get-FileHash -Algorithm MD5 -Path '%%D\*' | Sort-Object Path | Select-Object -Property Hash,Path | Out-String -Stream" | sed -e "/^Hash/d; /^---/d; /^$/d; s/%BASE_PATH%//"
endlocal