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
@JakeWharton
JakeWharton / CovariantReturnTypes.java
Created January 7, 2016 05:59
Covariant return types generate an extra method in bytecode. This compounds in each subclass further specializing the type.
interface Thing {
Object thing();
}
class CharSequenceThing implements Thing {
@Override public CharSequence thing() {
return "CharSequence!";
}
}
@Chandler
Chandler / slack_history.py
Last active March 27, 2025 01:16
Download Slack Channel/PrivateChannel/DirectMessage History
print("UPDATE AUG 2023: this script is beyond old and broken")
print("You may find interesting and more up to date resources in the comments of the gist")
exit()
from slacker import Slacker
import json
import argparse
import os
# This script finds all channels, private channels and direct messages
@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
@jojonas
jojonas / st2vim_themes.py
Last active January 27, 2025 17:45
Converter for Sublime Text themes to VIM themes
from __future__ import print_function
import sys
import argparse
import os.path
import textwrap
import re
from pprint import pprint
import xml.etree.ElementTree as ET
@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})
@christophermark
christophermark / Doze_Mode_Behavior.md
Last active August 20, 2021 21:37
Android Marshmallow Idle Mode Behavior

What is "idle mode"?

Idle mode is a state where the phone has no network connectivity and apps are temporarily suspended. Idle mode gets triggered by one of two ways: an asleep, still, unplugged phone (Doze mode), and when an app has not been opened in a significant amount of time (App Standby Mode). During idle mode via Doze, the phone will wake up periodically for a short amount of time, allowing apps to run and use network connectivity. Using several different methods outlined below, it is possible to wake apps up during idle mode outside of these maintenance windows.

Time to enter Doze mode

1 hour of being still after the screen turns off.

Time to enter App Standby mode

TBD

Idle maintenance windows

@paulirish
paulirish / what-forces-layout.md
Last active August 28, 2025 15:03
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent
@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