Skip to content

Instantly share code, notes, and snippets.

@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#
#
@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
// 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 / 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 / delete_remotes
Last active August 29, 2015 14:14
batch delete remote branches
#!/usr/bin/env ruby
abort 'please specify the remote to delete branches from' if ARGV.empty?
remote = ARGV.shift
puts "gathering list of branches for remote '#{remote}'"
branches = `git branch -r | grep #{remote}`.lines
branches.map! { |s| s.strip! }
branches.reject! { |b| b =~ /.*\/master/ }
branches.join("\n")
@ellemenno
ellemenno / code-readme.md
Created January 4, 2015 23:39
code project README template

<project-name>

<project-tagline>

installation

<steps to install>

@ellemenno
ellemenno / minimaloom.md
Last active August 29, 2015 14:12
minimal examples of Loom GUI and CLI apps

GUI Application

TestGUI.ls

package
{
    import loom.Application;
    import loom2d.display.StageScaleMode;
    import loom2d.ui.SimpleLabel;
@ellemenno
ellemenno / title_func.sh
Last active September 7, 2015 19:47
Set shell title
# set the title of the current Terminal tab
function title {
printf "\033]0;%s\007" "$1"
}
@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 = '/'