Skip to content

Instantly share code, notes, and snippets.

Carleton pca2

Block or report user

Report or block pca2

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@pca2
pca2 / all_profiles.json
Last active Jun 25, 2019
iterm personal profile
View all_profiles.json
{
"Profiles": [
{
"Working Directory" : "\/Users\/carleton",
"Prompt Before Closing 2" : 0,
"Selected Text Color" : {
"Green Component" : 1,
"Red Component" : 0.99989014863967896,
"Blue Component" : 0.999828040599823
},
View find_files_not_matching.py
#Search for files that do NOT contain a given string
#Import os module
import os
# Ask the user to enter string to search
search_path = input("Enter directory path to search : ")
file_type = input("File Type : ")
search_str = input("Enter the search string : ")
# Append a directory separator if not already present
View rename.py
import os, re, glob
#get file list
with open('order.txt') as file:
titles = file.readlines()
#remove \n
for index, item in enumerate(titles, start=0):
titles[index] = item.rstrip()
View clock.go
package clock
import (
"fmt"
)
type clock struct {
hour int
minute int
}
@pca2
pca2 / 538.1h.rb
Created Oct 17, 2018
BitBar Plugin that Scrapes election odds from FiveThirtyEight's Midterm election tracker
View 538.1h.rb
#!/usr/bin/env ruby
# <bitbar.title>538 Midterm Tracker</bitbar.title>
# <bitbar.version>v1.0</bitbar.version>
# <bitbar.author>Carleton Atwater</bitbar.author>
# <bitbar.author.github>pca2</bitbar.author.github>
# <bitbar.desc>Scrapes election odds from FiveThirtyEight's Midterm election tracker</bitbar.desc>
# <bitbar.image>https://imgur.com/bCF8fyg.png</bitbar.image>
# <bitbar.dependencies>ruby,Chrome, Mac OS X</bitbar.dependencies>
# This code is pretty hacky, but it was a fun 1 hour project to track something 20ish days away.
require 'nokogiri'
@pca2
pca2 / weightCheck.js
Last active Oct 1, 2018
Combining MongoDB Stitch Triggers and Services
View weightCheck.js
exports = function(changeEvent) {
const http = context.services.get("wt_http_service");
const newWeight = changeEvent.fullDocument.weight;
const thresholdWeight = 145;
const slackURL = 'https://hooks.slack.com/services/T8MHO2QSKK/BW8EFN/B5nKgGZYLuZcKgvY8rNvzHE';
const slackMsg = `Uh-oh a weight was posted of ${newWeight}, better lay off the pie`;
if(newWeight < thresholdWeight ){
return "Weight under threshold";
} else {
@pca2
pca2 / fruitjuice.sh
Last active Nov 3, 2018
Linux Battery Unplug Reminder script (FruitJuice)
View fruitjuice.sh
#! /bin/bash
#Adapted from https://linoxide.com/linux-how-to/remind-unplug-charging-laptop-arch-linux/
# DEBUG=true #uncomment to enable logging
MIN_BAT=40
MAX_BAT=80
log(){
datestamp=$(date +%Y-%m-%d_%H:%M:%S)
msg="$@"
echo "[$datestamp]- $msg"
}
@pca2
pca2 / get_line.sh
Last active Jan 8, 2018
return specific line number from file
View get_line.sh
# return line number $1 from file $2
get_line () { sed -n "$1,0p" $2 ; }
You can’t perform that action at this time.