Skip to content

Instantly share code, notes, and snippets.

View Rican7's full-sized avatar
😮
My dotfiles just keep getting better... and its been OVER 10 YEARS NOW! ⌚😮🤯

Trevor N. Suarez Rican7

😮
My dotfiles just keep getting better... and its been OVER 10 YEARS NOW! ⌚😮🤯
View GitHub Profile
@Rican7
Rican7 / unicode_rune_handling.go
Created March 10, 2016 19:01
Unicode rune handling in multiple languages
package main
import (
"fmt"
"unicode/utf8"
)
const strangeMessage = "TᕼIᔕ ᗰᕮᔕᔕᗩGᕮ Iᔕ ᑭᖇOTᕮᑕTᕮᗪ ᗷY ᗩ ᔕᑭᕮᑕIᗩᒪ ᖴOᑎT. IT'ᔕ IᗰᑭOᔕᔕIᗷᒪᕮ TO ᑕOᑭY IT. TᖇY ᗩᑎᗪ YOᑌ ᗯIᒪᒪ ᖴᗩIᒪ"
func main() {
@Rican7
Rican7 / configure-vim
Last active September 15, 2016 22:03
My VIM compilation configure line
#!/usr/bin/env bash
./configure --prefix=/usr/local --with-features=huge --enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-cscope [email protected]
@Rican7
Rican7 / list-interface-types-for-go-project.sh
Last active March 1, 2016 19:23
List interface types for a Go project using Sift (https://sift-tool.org/)
#!/usr/bin/env sh
# NOTE! This requires the "Sift" tool, GNU "sed", and Go (Golang)
#
# https://sift-tool.org/
# https://github.com/svent/sift
# https://www.gnu.org/software/sed/
# https://golang.org/
# https://golang.org/cmd/go/#hdr-Show_documentation_for_package_or_symbol
@Rican7
Rican7 / loop-curl.sh
Created November 18, 2015 06:20
Perform a cURL variable path request in a loop
#!/usr/bin/env bash
readonly ACCESS_TOKEN=""
readonly IDS=(
1
2
3
)
for id in ${IDS[@]};
@Rican7
Rican7 / conventional-json.go
Last active November 27, 2023 07:10
Marshal JSON in Golang using common lower-snake-case object key conventions
package main
import (
"bytes"
"encoding/json"
"fmt"
"regexp"
"time"
)
@Rican7
Rican7 / autoset-hostname.sh
Last active November 9, 2015 18:22
Automatically set a structured, formatted hostname containing the AWS EC2 Instance ID for an EC2 virtual machine running RHEL/CentOS 6.x.
#!/usr/bin/env bash
# Enable strict error handling
set -u -o pipefail
# Define our hostname formats
readonly HOSTNAME_FORMAT="%s.my-service-name.environment-name"
readonly FQDN_HOSTNAME_FORMAT="%s.service.example.com"
# Get the current hostname
@Rican7
Rican7 / processpls
Created October 16, 2015 18:50
Bash process. Pls.
#!/usr/bin/env bash
readonly PROGRESS_BAR_WIDTH=25
readonly PROGRESS_BAR_STEP_CHAR='#'
echo "Processing..."
for i in $(seq ${PROGRESS_BAR_WIDTH}); do
steps=$(printf "${PROGRESS_BAR_STEP_CHAR}%.0s" $(seq $i))
formatted=$(printf "%-${PROGRESS_BAR_WIDTH}s" ${steps})
@Rican7
Rican7 / Bash 4 coprocesses and external data mapping
Last active December 11, 2015 19:44
Bash mapping data from an external file
NOTE! This requires Bash v4.x
@Rican7
Rican7 / log-request.php
Last active August 29, 2015 14:26
PHP HTTP Request Dumper
<?php
ini_set('error_reporting', E_ALL);
ini_set('display_errors', 1);
ini_set('log_errors', 1);
date_default_timezone_set('UTC');
const LOG_PATH = '/var/log/debug/request-dump.log';
@Rican7
Rican7 / gifsicle-optimize.sh
Last active September 14, 2023 08:23
Optimize a GIF for smaller size using Gifsicle
#/usr/bin/env bash
#
# Gifsicle: http://www.lcdf.org/gifsicle/man.html
#
# Use `seq` to create a list sequence of integers, skipping every even number
# `seq -f "#%g" 0 2 213`
gifsicle --unoptimize image.gif | gifsicle --dither --colors 48 --resize-fit-width 512 -O2 `seq -f "#%g" 0 2 213` -o image.optimized.gif