This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Animal: | |
class_var = 'foo' | |
def __init__(self, name, age=11): | |
self.name = name | |
self.age = age | |
def greet(self): | |
print(f"Hello, I'm {self.name}") | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Profiles": [ | |
{ | |
"Working Directory" : "\/Users\/carleton", | |
"Prompt Before Closing 2" : 0, | |
"Selected Text Color" : { | |
"Green Component" : 1, | |
"Red Component" : 0.99989014863967896, | |
"Blue Component" : 0.999828040599823 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package clock | |
import ( | |
"fmt" | |
) | |
type clock struct { | |
hour int | |
minute int | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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" | |
} |