{{ message }}

Instantly share code, notes, and snippets.

💭
probably playing code golf

# Rob Papesch roblogic

💭
probably playing code golf
• Auckland, NZL
Created Dec 17, 2020
Shorter version, slower and the drawing is a bit worse, but saves bytes :P
View hackerlogo-sm.bas
 0data51,29,73,51,73,73,51,73,29,73 1hgr:hcolor=3:fori=0to123:hplot0,i to123,i:next 2hcolor=0:fori=18to84step22:hplot18,i to84,i:hploti,18toi,84:next 3fori=1to5:reada,b:a=a+.5:b=b+.5:gosub8:next:end 8forr=1to9:hplota,b:forn=0to6.3step.1:y=sin(n)*r:x=cos(n)*r:hplottoa+x,b+y 9next:next:return
Created Dec 17, 2020
Apple II BASIC code for drawing the "hacker logo": a glider from Conway's Game of Life
View hacker-logo-glider.bas
 0data51,29,73,51,73,73,51,73,29,73 1hgr2:hcolor=3:fori=0to191:hplot0,i to191,i:hplot i,0toi,191:next 2hcolor=0:fori=18to84step22:hplot18,i to84,i:hplot i,18toi,84:next 3fori=1to5:reada,b:a=a+.5:b=b+.5:gosub4:next:end 4forr=0to9step0.5:r2=r*r:for x=0 to r:y=sqr(r2-x*x) 5hplot a+x,y+b:hplot a-x,y+b:hplot a+x,-y+b:hplot a-x,-y+b 6hplot a+y,x+b:hplot a-y,x+b:hplot a+y,-x+b:hplot a-y,-x+b 7next:next:return
Last active Dec 2, 2020
Fortran, 147 bytes solution to https://codegolf.stackexchange.com/a/215896/15940
View fortran-strip-string.md

Per [wikibooks][1], "It should be remembered that Fortran is designed for scientific computing and is probably not a good choice for writing a new word processor.". Fortran doesn't have a regex concept either. This just makes [string][2] [challenges][3] more [interesting][4]!

In this solution, we trim the string `S`, then iterate over it. Print each character unless it's a space followed by another space. [Try it Online!][5]

``````character(99)S;read(*,'(A)')S
do i=1,len(S);if(S(i:i+1).ne.'  ')then
endif;enddo;end
``````
Created Nov 19, 2020
Regular Expressions in Zsh
View zshexpn-explained.md

The following is taken from a brilliant answer on unix.se. Posting it here for personal reference. The question was:

# What kind of patterns can I use in zsh parameter expansion?

`\${var//pattern/replacement}` is using zsh wildcard patterns for `pattern`, the same ones as used for filename generation aka globbing which are a superset of the `sh` wildcard patterns. The syntax is also affected by the `kshglob` and `extendedglob` options. The `\${var//pattern/replacement}` comes from the Korn shell initially.

I'd recommend enabling `extendedglob` (`set -o extendedglob` in your `~/.zshrc`) which gives you the most features (more so than standard EREs) at the expense of some backward incompatibility in some corner cases.

You'll find it documented at `info zsh 'filename generation'`.

Last active Nov 10, 2020
Golf solution to "ASCII Triangles", https://codegolf.stackexchange.com/a/215028/15940 (60 bytes)
View triangles.zsh
 for ((;i<\$1;))printf "|%\$[i++]s\\\\\n"&&a=\$a- ((\$1))&&<<<\$a-
Created Nov 4, 2020
fun with @ish_app -- fill screen with technicolor spew
View static
 #!/bin/zsh P=(' ' █ ░ ▒ ▓) while :;do printf "\e[9\$(( ( RANDOM % 7 ) + 1 ))m\e[\$[RANDOM%\$LINES+1];\$[RANDOM%\$COLUMNS+1]f\${P[\$RANDOM%5]}" done
Last active Oct 12, 2020
pattern matcher for doing simon shuker's code-cracker in the nz herald. ".txt" uses data from https://github.com/dolph/dictionary/blob/master/unix-words
View patt
 #!/bin/sh [ "\$1" ] || { echo "pattern?"; exit; } patt="\$1" grep -E "^\$patt\$" *.txt | awk -F: '{print \$2}'| sort -u | paste - - - - -
Last active Oct 12, 2020
my jazzy iSH profile for iPhone
View .profile
 uname -v neofetch --off #resize set -o vi export PS1="\w\$ " alias l="ls -alp" alias ll="ls -alptr|tail -20" alias ls="ls -p" rap(){ echo "\$(fortune)" \ |tr -d '\t'|tr '\n' ' ' \
Last active May 30, 2020
messing about with a blog's CSS
View stan.user.css
 /* ==UserStyle== @name TheStandard ReArranger @description Change fonts and rearrange random things for fun and \$\$\$ @namespace https://github.com/roblogic @version 0.1.0-fiasco @author roblogic @license unlicense @preprocessor stylus ==/UserStyle== */
Last active Apr 4, 2021
Code Page 437 / Extended ASCII
View CP437.md

`CP437` is a ubiquitous character set that appears somewhat obsolete, but is still found everywhere. Usually seen in BIOS, there are no fancy fonts here. Here's the charset, using UTF-8 equivalents.

``````································ !"#\$%&'()*+,-./0123456789:;<=>?
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~�
ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñÑªº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐
└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■
``````

Found this useful bash script on stackoverflow.