Skip to content

Instantly share code, notes, and snippets.

View superatomic's full-sized avatar
I may be slow to respond.

Olivia Kinnear superatomic

I may be slow to respond.
View GitHub Profile
@superatomic
superatomic / lst
Created November 29, 2023 05:06
lst: strip comments, empty lines, and indentation from files
#!/bin/bash
sed -rf- -- "$@" <<-EOF
s/([^#]*)#.*$/\1/ # remove comments
s/^\s*//;s/\s+$// # strip leading and trailing whitespace
/^$/d # remove blank lines
EOF
@superatomic
superatomic / unique.py
Created May 28, 2023 19:43
A python 3.12 `unique` function, with type hints.
from collections.abc import Hashable, Iterable, Iterator
def unique[T: Hashable](items: Iterable[T]) -> Iterator[T]:
seen = set()
for item in items:
if item not in seen:
seen.add(item)
yield item
@superatomic
superatomic / xshe.toml
Last active June 29, 2022 05:07
Xshe Example – Cross-Shell Environment Variable Configuration
#############################################################
# Cross-Shell Environment Variable Configuration using Xshe #
# https://github.com/superatomic/xshe #
#############################################################
# Xshe allows for setting environment variable across multiple shells:
PS1 = '> '
# These lines add the environment variables for the XDG Base Directory Specification.
# (https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html)
@superatomic
superatomic / xshe-v0.3.2.toml
Last active April 15, 2022 23:29
OUTDATED Xshe v0.3.2 Example – Cross-Shell Environment Variable Configuration
##############################################################################################
## ======================================================================================== ##
## ⚠️ THIS FILE IS OUTDATED; DO NOT USE IT! ##
## ⚠️ UPDATED VERSION: https://gist.github.com/superatomic/52a46e53a4afce75ede4db7ba6354e0a ##
## ======================================================================================== ##
##############################################################################################
# Original file contents is as follows:
#############################################################
@stonehippo
stonehippo / language_installers.md
Last active February 24, 2024 02:39
Programming language version managers

Programming language version managers

Keeping up to date with a program language installation isn't always easy. In particular, juggling the latest and greatest,legacy versions needed to maintain compatibility, keeping several versions of a langauge installed, or needing admin acess can be a real pain. The package manager included with your operating system, such as dpkg/apt or yum might help somewhat, but they usually cannnot handle multiple versions, typically want you to be an admin, and often do not have the most recent version available in their repos.

So what's an enterprising dev to do?

One answer is to install a dedicted tool for installing a managing a program language. These tools operate a bit like a language-specific package manager, with tools for installing, managing and swapping versions of a language. They operate by adjusting your path, often via a 'shim' pointing to a local install. They typically leave your system-installed versions alone. All in all, these tools are a huge boon

@Robbepop
Robbepop / .rustfmt.toml
Created March 16, 2017 18:19
.rustfmt.toml with all configs, descriptions, parameters and defaults for version 0.7.1 of rustfmt.
# ----------------------------------------------------------------------------------
# r u s t f m t - C O N F I G
# ==================================================================================
#
# Version: 0.7.1
# Author : Robbepop <robbepop@web.de>
#
# A predefined .rustfmt.toml file with all configuration options and their
# associated description, possible values and default values for use in other
# projects.
@zlbruce
zlbruce / svg2icns
Created October 1, 2016 01:17
covert svg to icns (with imagemagick)
#!/bin/bash
echo "*** SVG 2 ICNS ***"
if [ $# -ne 1 ]; then
echo "Usage: svg2icns filename.svg"
exit 100
fi
filename="$1"
name=${filename%.*}
ext=${filename##*.}
echo "processing: $name"

Contributing

When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Pull Request Process

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a
@azam
azam / svg2ico.sh
Last active April 28, 2024 03:28
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 256x256 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
# to install the latest stable version:
brew install scala --with-docs
# to install scala-2.10:
brew install https://raw.github.com/gist/4340744/scala.rb --with-docs
# to switch versions (from https://github.com/mxcl/homebrew/wiki/External-Commands):
brew switch scala 2.9.2
brew switch scala 2.10.0