Skip to content

Instantly share code, notes, and snippets.

View chtzvt's full-sized avatar
🌻
‍To create a little flower is the labor of ages.

Charlton Trezevant chtzvt

🌻
‍To create a little flower is the labor of ages.
View GitHub Profile
@chtzvt
chtzvt / spamkiller_lighttpd.conf
Last active August 29, 2015 14:19
Spam Crawler/Referrer Blocker for Lighttpd
Moved to https://github.com/ctrezevant/everlasting-botstopper!
@chtzvt
chtzvt / sort.sh
Last active August 29, 2015 14:21
episorter
# Get num of episodes in the current directory by
# Searching for files that contain 'Episode' in the name.
EP=`ls | grep -i 'Episode' | wc -l`
# Get current season from the name of the directory we're currently in
# This assumes that episodes are in directories by episode, like so:
# /path/to/TV Show/Season 1/
SEASON=`pwd | grep -o '[0-9]*'`
# Initialize the variable we'l be using for the while loop.
I=1
@chtzvt
chtzvt / notify.sh
Last active September 7, 2015 15:09
linux-boot-notify
# Boot email notification by Charlton Trezevant
# Version 3.0
###SETUP:
# Just paste it right in to /etc/rc.local
# Note that this depends on having mailx and postfix installed.
# See below for more info.
###DEPENDENCIES
# This script requires mailx and postfix to be installed.
@chtzvt
chtzvt / apush-scraper.sh
Last active September 24, 2015 23:49
A script I used to scrape my APUSH textbook from Google's cache.
echo "Downloading APUSH book..."
# Initialize total downloaded count.
DLT=0
echo "Creating downloads directory (./apush-dl)"
# Create downloads directory and redirect stderr to /dev/null (in case the directory already exists).
mkdir ./apush-dl/ 2>/dev/null
# There are 32 chapters.
@chtzvt
chtzvt / fizzbuzz.js
Created October 15, 2015 23:46
FizzBuzz example
// Test the divisibility of numbers from 1-100.
for (var i = 1; i <= 100; i++) {
// Is the number evenly divisible by both 3 and 5?
if((i % 3 === 0) && (i % 5 === 0)){
console.log('fizzbuzz');
// No? Then let's see whether it's divisible by 3.
} else if(i % 3 === 0) {
console.log('fizz');
// Still no? Let's try 5, then.
} else if (i % 5 === 0){
@chtzvt
chtzvt / .bash_profile
Created March 12, 2016 23:00
Sick, informational bash profile: https://imgur.com/g1Nym7r
#!/usr/bin/env bash
# Calculate uptime days/hrs/mins/secs
let upSeconds="$(/usr/bin/cut -d. -f1 /proc/uptime)"
let secs=$((${upSeconds}%60))
let mins=$((${upSeconds}/60%60))
let hours=$((${upSeconds}/3600%24))
let days=$((${upSeconds}/86400))
UPTIME=`printf "%d days, %02dh%02dm%02ds" "$days" "$hours" "$mins" "$secs"`
@chtzvt
chtzvt / bigguy.js
Created April 25, 2016 21:07
Web-friendly reimplementation of https://gist.github.com/ctrezevant/175d098088b71b823450, because I hate the world
// BANEPOST.JS: FOR BIG GUYS
// By Charlton Trezevant
// Responses.
var uuuu = [ "You're a big guy.", "He didn't fly so well", "...for you.", "TELL ME ABOUT BANE. WHY DOES HE WEAR THE MASK?",
"The flight plan I just filed with the agency lists me, my men, Dr.Pavel here, but only ONE of YOU!", "Dr.Pavel, I'm CIA.", "The masked man 0_0",
"Nobody cared who I was 'til I put on the mask.", "If I pull that off will you die?", "Crashing this plane, WITH NO SURVIVORS.",
"Was getting caught part of your plan?", "He wasn't alone.", "You don't get to bring friends.", "Don't worry, no charge for them.",
"Get 'em on board - I'll call it in.", "FIRST ONE TO TALK GETS TO STAY ON MY AIRCRAFT.", "HE DIDN'T FLY SO GOOD! WHO WANTS TO TRY NEXT?!",
"LOT OF LOYALTY FOR A HIRED GUN!", "Or perhaps he's wondering why someone would shoot a man before throwing him out of a plane?",
@chtzvt
chtzvt / spongegar.js
Last active June 1, 2016 02:56
This is what runs @_spongegar
var CONFIG = {
BOT_NAME: '_spongegar',
MEDIA_ID: '737763742998355968',
TWITTER_API_KEYS: {
consumer_key: ' ',
consumer_secret: ' ',
access_token: ' ',
access_token_secret: ' ',
}
}
@chtzvt
chtzvt / doorMan_bot.js
Last active July 22, 2016 22:52
Twitter bot to control your garage door using the Doorman API.
// Moved to https://github.com/ctrezevant/doorMan/blob/master/DoorMan_twitterBot.js
@chtzvt
chtzvt / flac_mp3.sh
Last active July 24, 2016 18:08
Convert all FLAC files in the current directory to 320kbps MP3, preserving ID3 tags (aka track metadata)
find . -name "*.flac" -exec avconv -i {} -ab 320k -map_metadata 0 -id3v2_version 3 {}.mp3 \;