Skip to content

Instantly share code, notes, and snippets.

@rbreaves
rbreaves / gist:d185c1cd2892561199f5b90e1af5117b
Last active January 12, 2018 20:00
Gmail - Archive > 1 week && Mark As Read > 2 weeks
function markArchivedAsRead() {
var delayDays = 7; // will only impact emails more than 7 days old
var maxDate = new Date();
maxDate.setDate(maxDate.getDate()-delayDays); // what was the date at that time?
//Look for unread emails that are older than 14 days and exclude starred emails
var threads = GmailApp.search('label:unread older_than:14d -is:starred');
GmailApp.markThreadsRead(threads);
@rbreaves
rbreaves / cfconvention.sh
Last active April 14, 2018 17:55
Fix improper Coldfusion Code Conventions with Perl
#!/bin/sh
# Run script in the root directory of the site
#Fix tag based functions that have eol and tabs in the tag
find . -name '*.cf*' -not -name '*.json' | xargs perl -i -0pe 's/(?:\G|\<cf)(?:(?!\>).)*\K\n\t+/ /g'
#Fix script based functions that also have eol and tabs
find . -name '*.cf*' -not -name '*.json' | xargs perl -i -0pe 's/(?:\G(?!\A)|\tpublic|\tremote|\tprivate)(?:(?!\)).)*?\K\n\t+/ /g'
@rbreaves
rbreaves / relocateUnreadCountGmail.user.js
Created June 15, 2018 04:41
Unread Count on the Left in Gmail
// ==UserScript==
// @name Relocate Unread Count for Gmail
// @namespace http://elomental.com/
// @version 1.0
// @description Relocate the unread count to the left for Gmail labels
// @author Ryan Reaves
// @match https://mail.google.com/*
// @require https://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant none
@rbreaves
rbreaves / ping-color
Created September 16, 2019 13:53
Ping Latency with Color
# Add to .zshrc or .bashrc
alias pg=pingout
pingout(){
ping 8.8.8.8 | awk -F" |=" '/time/{if($10>0 && $10<=70){printf "\033[1;32m%i\n\033[0m", $10}; if($10>70 && $10<=99){printf "\033[33m%i\n\033[0m", $10};if($10>99){printf "\033[31m%i\n\033[0m", $10 }}'
}
@rbreaves
rbreaves / vmboxkeyswap.py
Last active January 28, 2020 04:00
VirtualBox macOS keyswap for alt and cmd
#!/usr/bin/python
# Fixes the macOS keymap on the host to swap Alt & Cmd
# This allows for proper key location when using Virtual Machines under VirtualBox
# Support for Vmware and Parallels can easily be added via the app names
# Also Virtualbox does not detect the keyswap initially, so another app has to
# steal focus and then return focus to VirtualBox. Unknown if the same applies
# to the other VM solutions.
from AppKit import NSWorkspace
@rbreaves
rbreaves / ComptonGalliumBlur.txt
Last active May 10, 2020 03:27
Install compton with blur on galliumOS
git clone https://github.com/tryone144/compton
# Install all dependencies
sudo apt install libx11-dev libxcomposite-dev libxdamage-dev libxfixes-dev libxrender-dev libxrandr-dev libxinerama-dev pkg-config libconfig-dev libpcre3-dev libdbus-1-dev libdrm-dev mesa-common-dev libgl1-mesa-dev xsltproc
# Do this separate to install 1mb instead of 500mb+
sudo apt-get --no-install-recommends install asciidoc
# Make the main program
@rbreaves
rbreaves / compton.conf
Last active May 16, 2020 08:59
galliumOS Compton for tryone
# Compton Configuration, courtesy of Xubuntu Developers
# Please note that Compton is not supported by Xubuntu and may not work
# correctly for you. This file is provided as a set of sane defaults and is in
# no way endorsed by the Xubuntu team.
#
# About Compton: https://github.com/chjj/compton
# Heavily based on: http://bit.ly/1l5OrzL
# Sample settings: https://github.com/chjj/compton/blob/master/compton.sample.conf
# --- Backend (OpenGL used by default)
@rbreaves
rbreaves / DegreenMate.txt
Last active May 26, 2020 02:45
Degreen Ubuntu Mate
#!/bin/bash
# Let's admit it.. Ubuntu Mate's GUI is very uninspired
# possibly on purpose, who knows. This script attempts
# to quickly undo the most of what the distro authors
# thinks looks good w/ more normal defaults.
#
# Personality is fine, but UI designers that do a poor
# job need to make sure there's an easy undo button.
@rbreaves
rbreaves / .vimrc
Last active June 8, 2020 21:39
Universal OS vimrc settings
" https://vi.stackexchange.com/questions/2572/detect-os-in-vimscript
" Comment - cross-platform settings
set nocompatible
set mouse=a
" OS Specific
if has('win32')
" Windows
" arrow keys
set term=pcansi
@rbreaves
rbreaves / PowerAndSleepMBP-Win10
Created July 25, 2020 06:02
Proper Sleep and Power Plan Settings for MBP 2017 Running Windows 10
Sleep mode does not work well on my MacBook Pro 2017 model with Windows 10 build 2004 (July 2020) so this is needed
1) Install PsShutdown.exe to C:\Windows
https://docs.microsoft.com/en-us/sysinternals/downloads/pstools
2) Install System Silencer
https://apps.nozavi.com/apps/system-silencer/download/file/4-system-silencer-zip.html
3) Create batch file to run psshutdown, please in directory with system silencer, set System Silencer to autostart
psshutdown -d -t 0
4) Install PowerSchemeSwitcher
https://www.microsoft.com/en-us/p/powerplanswitcher/9nblggh556l3?activetab=pivot:overviewtab
5) Configure on AC and off AC power plans