Skip to content

Instantly share code, notes, and snippets.

@ellemenno
ellemenno / aws-session
Last active July 7, 2022 14:17 — forked from ogavrisevs/aws-temp-token.sh
Script to retrieve temp auth token from AWS STS
#!/bin/bash
# Uses AWS CLI and user-provided MFA code to retrieve and store
# temp session credentials from AWS Security Token Service (STS),
# - for user sessions via get-session-token
# - or role sessions via assume-role
#
# Stores 'token_expiration' in the profile to enable checks on session time left
@ellemenno
ellemenno / mst.dart
Last active April 15, 2022 14:43
minimum spanning tree in dart using kruskall's algorithm and disjoint set union
/// Represents a weighted graph edge, connecting vertices [v1] and [v2].
class Edge {
final int v1, v2;
int weight;
@override
String toString() => '${v1},${v2};${weight}';
Edge(this.v1, this.v2, this.weight);
@ellemenno
ellemenno / colortest
Created December 12, 2021 09:32
ansi colortest for cmd and bash
#!/usr/bin/env bash
# syntax : Esc[##;##m :: set bg;fg
# Esc[##m :: set one
# Esc[0m :: reset
#
# fg bg
# dark : Esc[3#m : Esc[4#m
# bright : Esc[9#m : Esc[10#
#
// For documentation on these settings, see: https://aka.ms/terminal-documentation
// To learn more about global settings, visit https://aka.ms/terminal-global-settings
{
"$schema": "https://aka.ms/terminal-profiles-schema",
// profile to use when typing ctrl+shift+t, the newTab key binding, running wt new-tab without specifying a profile, or clicking the '+' icon
"defaultProfile": "{2c4de342-38b7-51cf-b940-2309a097f518}",
// application theme (different than terminal color scheme). "system" will use the same theme as Windows, e.g. dark
"theme": "system",
@ellemenno
ellemenno / .profile
Last active June 6, 2021 21:54
The little tweaks I've accumulated and grown accustomed to.
# prompt (see https://tldp.org/HOWTO/Bash-Prompt-HOWTO/bash-prompt-escape-sequences.html)
# this prompt has 3 parts:
# 1. exit code indicator. test $? and print green ○ (U+25CB) for success (0), or red ● (U+25CF) for fail (non-zero)
# 2. current working directory. print \W in bold
# 3. UID indicator. \$ gives # for root, $ otherwise; print in bold
export PS1="\$([ \$? = 0 ] && echo '\[\e[32m\]○\[\e[0m\]' || echo '\[\e[31m\]●\[\e[0m\]') \[\e[1m\]\W \$ \[\e[0m\]"
# aliases (use `alias` to list)
alias ls="ls -hF"
alias l="ls -1"
@ellemenno
ellemenno / spinner.rb
Created March 11, 2014 16:41
ascii spinner
#!/usr/bin/env ruby
# encoding: UTF-8
@dot_cycle = ['⣾','⣽','⣻','⢿','⡿','⣟','⣯','⣷']
#braille random: 0x2800 - 0x28ff
@z_arrow = ['←','↖','↑','↗','→','↘','↓','↙']
@z_b = ['b','ᓂ','q','ᓄ']
@z_d = ['d','ᓇ','p','ᓀ']
@ellemenno
ellemenno / tree
Last active July 22, 2017 18:16
Directory tree printer
#!/usr/bin/env ruby
# encoding: utf-8
@bar = '─'
@elbow = '└'
@pipe = '│'
@space = ' '
@tee = '├'
@slash = '/'
@ellemenno
ellemenno / hilighter_test.md
Last active February 18, 2017 20:08
testing rouge support for ls
// ls - loomscript syntax highlighting
package {
        public class Fail {}
}
/* ls - loomscript syntax highlighting */
package {
@ellemenno
ellemenno / Feathers Font Quads.md
Last active December 24, 2015 20:38
screenshots of the Loom FeathersExample on Android, iOS, and OS X

trouble with font quads in sprint31 on Android 4.1.2 (regression from sprint30)

screenshot images below

@ellemenno
ellemenno / TinyLsTest.md
Last active December 22, 2015 19:18
testing out TinyLS