Skip to content

Instantly share code, notes, and snippets.

Avatar
🌻

Charlton Trezevant ctrezevant

🌻
View GitHub Profile
@ctrezevant
ctrezevant / spamkiller_lighttpd.conf
Last active Aug 29, 2015
Spam Crawler/Referrer Blocker for Lighttpd
View spamkiller_lighttpd.conf
Moved to https://github.com/ctrezevant/everlasting-botstopper!
@ctrezevant
ctrezevant / sort.sh
Last active Aug 29, 2015
episorter
View sort.sh
# 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
@ctrezevant
ctrezevant / notify.sh
Last active Sep 7, 2015
linux-boot-notify
View notify.sh
# 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.
@ctrezevant
ctrezevant / apush-scraper.sh
Last active Sep 24, 2015
A script I used to scrape my APUSH textbook from Google's cache.
View apush-scraper.sh
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.
View fizzbuzz.js
// 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){
View .bash_profile
#!/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"`
@ctrezevant
ctrezevant / bigguy.js
Created Apr 25, 2016
Web-friendly reimplementation of https://gist.github.com/ctrezevant/175d098088b71b823450, because I hate the world
View bigguy.js
// 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?",
@ctrezevant
ctrezevant / spongegar.js
Last active Jun 1, 2016
This is what runs @_spongegar
View spongegar.js
var CONFIG = {
BOT_NAME: '_spongegar',
MEDIA_ID: '737763742998355968',
TWITTER_API_KEYS: {
consumer_key: ' ',
consumer_secret: ' ',
access_token: ' ',
access_token_secret: ' ',
}
}
@ctrezevant
ctrezevant / doorMan_bot.js
Last active Jul 22, 2016
Twitter bot to control your garage door using the Doorman API.
View doorMan_bot.js
// Moved to https://github.com/ctrezevant/doorMan/blob/master/DoorMan_twitterBot.js
@ctrezevant
ctrezevant / flac_mp3.sh
Last active Jul 24, 2016
Convert all FLAC files in the current directory to 320kbps MP3, preserving ID3 tags (aka track metadata)
View flac_mp3.sh
find . -name "*.flac" -exec avconv -i {} -ab 320k -map_metadata 0 -id3v2_version 3 {}.mp3 \;