Skip to content

Instantly share code, notes, and snippets.

View tralston's full-sized avatar

Taylor Ralston tralston

  • Sacramento, CA
  • 15:26 (UTC -07:00)
View GitHub Profile
@robmiller
robmiller / play-wordle.rb
Last active February 15, 2022 19:40
A command-line, offline version of Wordle. A new word every time you run it.
#!/usr/bin/env ruby
#
# Play a command-line version of Wordle
#
# Original game by Josh Wardle: https://www.powerlanguage.co.uk/wordle/
#
# Installation and usage:
#
# 1. Save this file somewhere as play-wordle.rb
# 2. Run `ruby play-wordle.rb`
@icelander
icelander / upgrade_mattermost.sh
Last active March 23, 2021 22:23
An attempt to automate upgrades
#!/bin/bash
## upgrade_mattermost.sh
#
## About
#
# This script was an attempt to automate upgrading Mattermost. Note the past
# tense.
#
## Usage
@daehahn
daehahn / wsl2-network.ps1
Last active June 25, 2024 15:53
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}
@kpespisa
kpespisa / ToSafeString() extension method
Created February 13, 2015 21:56
ToSafeString() extension method to get an object's string representation or the empty string if the object is null
public static string ToSafeString(this object obj)
{
if (obj == null)
{
return string.Empty;
}
return obj.ToString();
}
@luciomartinez
luciomartinez / slash.sh
Last active June 23, 2024 19:34
Add or Remove trailing slash in bash
### Add trailing slash if needed
STR="/i/am/a/path"
length=${#STR}
last_char=${STR:length-1:1}
[[ $last_char != "/" ]] && STR="$STR/"; :
echo "$STR" # => /i/am/a/path/
@cimmanon
cimmanon / flexbox.scss
Last active September 17, 2020 15:05 — forked from anonymous/Flexbox mixins
This collection of Sass mixins to cover all 3 flexbox specifications that have been implemented. More information can be found here: https://gist.github.com/cimmanon/727c9d558b374d27c5b6
@import "compass/css3/shared";
// NOTE:
// All mixins for the 2009 spec have been written assuming they'll be fed property values that
// correspond to the standard spec. Some mixins can be fed values from the 2009 spec, but don't
// rely on it. The `legacy-order` mixin will increment the value fed to it because the 2009
// `box-ordinal-group` property begins indexing at 1, while the modern `order` property begins
// indexing at 0.
// if `true`, the 2009 properties will be emitted as part of the normal mixin call
@KartikTalwar
KartikTalwar / Documentation.md
Last active June 25, 2024 10:55
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@EvanK
EvanK / working_dir.sh
Created February 2, 2011 21:21
dirname(realpath($SOMEPATH)) in bash
#!/bin/sh
# 1. takes $0 (the currently running script)
# 2. puts it through `readlink -f` to resolve any symlinks
# 3. puts it through `dirname` to remove the filename
working_dir=$(dirname $(readlink -f $0))
# so if i symlink a script from /home/ekaufman/myinit.sh to /etc/init.d/mything then even if I
# execute /etc/init.d/mything, ${working_dir} will be "/home/ekaufman"