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 / label-github-emails-in-gmail.gs
Last active October 20, 2020 06:31
Filters Gmail message threads to apply helpful GitHub labels, for organization.
/**
* Labels Gmail email threads
*/
function labelGithubEmails() {
/**
* Gmail label names for GitHub messages
*/
const githubLabelName = 'GitHub'
const githubPullRequestLabelName = 'GitHub/Pull Request'
const githubIssueLabelName = 'GitHub/Issue'
@Rican7
Rican7 / check-deleted-slack-user-names
Created February 24, 2017 22:43
Check the name of the deleted users in your Slack organization using `jq`
#!/usr/bin/env sh
#
# Check the name of the deleted users in your Slack organization using `jq`
#
# Requires:
# - curl (https://curl.haxx.se/)
# - jq (https://stedolan.github.io/jq/)
set -u -o pipefail
@Rican7
Rican7 / upgrade-osx-bash.sh
Created September 15, 2016 23:11
Upgrade Bash on Mac OS X
#/usr/bin/env sh
#
# Requires homebrew (http://brew.sh/)
# Thanks http://clubmate.fi/upgrade-to-bash-4-in-mac-os-x/
brew update && brew install bash && sudo bash -c 'echo /usr/local/bin/bash >> /etc/shells' && chsh -s /usr/local/bin/bash
@Rican7
Rican7 / find-changed-files-with-old-copyright.sh
Last active May 11, 2016 20:38
Find's changed files that contain an old copyright date
@Rican7
Rican7 / get-mysql-database-size-meta.sql
Created April 27, 2016 16:14
Query MySQL database size meta
# Get the size meta of every accessible schema
SELECT
count(*) tables,
`table_schema`,
format(sum(`table_rows`)/1000000, 3) `rows (M)`,
format(sum(`data_length`)/(1024*1024*1024), 3) `data_size (GB)`,
format(sum(`index_length`)/(1024*1024*1024), 3) `index_size (GB)`,
format((sum(`data_length`+`index_length`))/(1024*1024*1024), 3) `total_size (GB)`,
format(sum(`index_length`)/sum(`data_length`), 3) `index_data_ratio`
FROM
@Rican7
Rican7 / CircularIterator.php
Created April 6, 2016 05:16
Circular (infinite) iterators in PHP. Because lol: https://github.com/alvaropinot/circular-iterator
<?php
class CircularIterator extends IteratorIterator {
public function next()
{
parent::next();
if (!$this->valid()) {
$this->rewind();
}
@Rican7
Rican7 / update-copyright-changed-files.sh
Last active May 11, 2016 20:37 — forked from jstruzik/copyright_doc_update_git_diff.sh
Update copyright date only for modified files
@Rican7
Rican7 / parse_ews_wsdl_supported_operation_input_headers.php
Created March 24, 2016 23:29
Parsing an EWS (Exchange Web Services) WSDL to determine the supported input headers per service operation in PHP
<?php
// The location of the EWS WSDL here (Office365 here for example)
const WSDL_URL = 'https://outlook.office365.com/EWS/Services.wsdl';
const NAMESPACE_WSDL_PREFIX = 'wsdl';
const NAMESPACE_WSDL_URI = 'http://schemas.xmlsoap.org/wsdl/';
const NAMESPACE_SOAP_PREFIX = 'soap';
const NAMESPACE_SOAP_URI = 'http://schemas.xmlsoap.org/wsdl/soap/';
@Rican7
Rican7 / parse_windowszones.php
Last active November 22, 2018 09:42
Parsing Unicode CLDR Windows Timezones in PHP
<?php
// The location of the Unicode CLDR "windowsZones" mappings here
const XML_URL = 'http://unicode.org/cldr/data/common/supplemental/windowsZones.xml';
const XML_ZONE_MAP_XPATH = '/supplementalData/windowsZones/mapTimezones/mapZone';
const ZONE_TERRITORY_ATTRIBUTE = 'territory';
const ZONE_IANA_NAME_ATTRIBUTE = 'type';
const ZONE_WINDOWS_NAME_ATTRIBUTE = 'other';
@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() {