Skip to content

Instantly share code, notes, and snippets.

View roblogic's full-sized avatar
💭
probably playing code golf

Rob Papesch roblogic

💭
probably playing code golf
  • Auckland, NZL
  • 13:40 (UTC +12:00)
View GitHub Profile
@roblogic
roblogic / zshexpn-explained.md
Created November 19, 2020 01:49
Regular Expressions in Zsh

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

${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'.

@roblogic
roblogic / msys2-setup.md
Last active March 26, 2024 19:20
MSYS2 first time setup

MSYS2 is a minimalist linux/unix shell environment for Windows.

Quote: "A modern replacement for MSYS bringing recent versions of the GNU toolchains, Git and other common Unix command line tools to the Windows platform"

1. Install

Do all the steps listed here: http://msys2.github.io/
(troubleshooting guide here: https://github.com/msys2/msys2/wiki/MSYS2-installation )

2. Set up proxies

@roblogic
roblogic / stan.user.css
Last active February 8, 2024 00:11
messing about with a blog's CSS
/* ==UserStyle==
@name TheStandard ReArranger
@description Change fonts and rearrange random things for fun and $$$
@namespace https://github.com/roblogic
@version 0.1.1-groovy
@author roblogic
@license unlicense
@preprocessor stylus
==/UserStyle== */
@roblogic
roblogic / CP437.md
Last active January 27, 2024 06:20
Code Page 437 / Extended ASCII

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.

@roblogic
roblogic / README.md
Created August 21, 2023 09:52 — forked from brennanMKE/README.md
Clone All Gists

Clone All Gists

This is a shell script version of the Node.js version created by mbostock.

Place it in a directory in your PATH and set the permissions.

chmod u+x clone-all-gists
@roblogic
roblogic / SysEnv.ahk
Created November 21, 2016 01:51
Editing Windows PATH with AutoHotKey
#SingleInstance, Force
#NoEnv ; somewhat ironic...
; this won't work in vista/7 if it's not run as an administrator.
; i'm too lazy to request it manually so the easiest way is to
; compile this script, and then under Compatibility tab in the
; compiled exe's Properties select "Run as Administrator"
RegRead, P, HKLM, SYSTEM\CurrentControlSet\Control\Session Manager\Environment, PATH
@roblogic
roblogic / yakgolf
Created February 3, 2023 20:54
Solution to Code Golf problem: "Yakko's New World Order", https://codegolf.stackexchange.com/q/257358/15940
#!/bin/zsh
argv=(abudhabi afghanistan albania algeria algiers angola argentina australia austria bahamas bahrain bangladesh barbados belgium belize benin bermuda bhutan bolivia borneo botswana brazil bulgaria burma burundi cameroon canada caribbean cayman chad chile china colombia congo costarica crete cuba cyprus czechoslovakia dahomey denmark djibouti ecuador egypt elsalvador england ethiopia fiji finland france frenchguiana gabon gambia germany ghana greece greenland guam guatemala guinea guinea-bissau guyana haiti honduras hongkong hungary iceland india indonesia iran iraq ireland israel italy jamaica japan jordan kampuchea kenya korea kuwait laos lebanon lesotho liberia libya liechtenstein luxembourg madagascar mahore malawi malaysia mali malta mauritania mexico monaco mongolia morocco mozambique namibia nepal newguinea newzealand nicaragua niger nigeria norway oman pakistan palestine panama paraguay peru poland portugal puertorico qatar republicdominican romania russia rwanda sanjuan saudiarabia scotlan
@roblogic
roblogic / bits.85
Last active November 23, 2022 05:14
Snippets for Arecibo Code Golf answer https://codegolf.stackexchange.com/a/191473/15940
0&M8}p.B@#L#QZE00001Fb*2U02+?qq#={[000069asT6g8.)4ZwEwH000Mg1onA4aoh}/0Q{6?7
?7Abap8T<N!#M/0000:ZZ{J%0d$no1{.{L01Yzs5hjUju{Cb/00eC!f:[8q1oX#k5eUKnfBigKaB
[#)FcD1?fA=JG2NyzwD&LsiWGLW<&LA29Gr+T=<o=q3huiZS05#83BRN)l3zmwk01TOWF4#ep&0Y
P[gY.1d24nhWll]9LmgYDLaoqEc0f^Fe]ZR$Y
#!/bin/zsh
setopt extendedglob
s=0
f(){
q=(${(s: :)${1//(#s)d/1d}//[^0-9]/ })
for i ({1..$q[1]})((s+=RANDOM%q[2]+1))
<<<$[s+q[3]]
}
f d1
f d6
@roblogic
roblogic / gruvbox8-to-vim
Last active November 7, 2022 16:41
Import new colorschemes to MacVim via Terminal
#!/bin/zsh
# refs:
# https://vimcolorschemes.com/lifepillar/vim-gruvbox8
# https://github.com/lifepillar/vim-gruvbox8
cd ~/.vim/colors
chmod 777 .
curl https://raw.githubusercontent.com/lifepillar/vim-gruvbox8/master/colors/gruvbox8.vim -o gruvbox8.vim
curl https://raw.githubusercontent.com/lifepillar/vim-gruvbox8/master/colors/gruvbox8_hard.vim -o gruvbox8_hard.vim
curl https://raw.githubusercontent.com/lifepillar/vim-gruvbox8/master/colors/gruvbox8_soft.vim -o gruvbox8_soft.vim