Skip to content

Instantly share code, notes, and snippets.

View ws's full-sized avatar

Will Smidlein ws

View GitHub Profile
@ws
ws / open-code-in-vscode.sh
Created March 11, 2025 21:14
Tell MacOS to use VScode for all code-like file extensions
#!/bin/bash
# This script sets Visual Studio Code as the default application for various code-related file extensions
# using `duti`. If `duti` is not installed, the script prompts the user to install it via Homebrew.
#
# Due to macOS system restrictions, setting .html as the default may fail if Chrome, VS Code, or other editors are open.
# In such cases, the script will notify the user to close those apps and retry.
# Check if duti is installed
if ! command -v duti &> /dev/null; then
@ws
ws / calculate-capital-gains.go
Created February 1, 2025 22:56
ETrade Capital Gains Calculator (Includes Quarterly Estimated Taxes)
// Thanks to @dantonnoriega for getting me started in the right direction:
// https://gist.github.com/dantonnoriega/fa0d3cdbb0b4012f217262c1bf405132
//
// To get your G&L_Collapsed.xlsx (quoting Dan's gist):
// Go to ETrade > Stock Plan > My Account > Gains & Losses.
// Select the proper tax year (e.g. 2022) then find the Download button towards the right side
// of the webpage below the Apply button.
// Click the Download button and select "Download Collapsed".
// This will download the appropriate excel sheet: G&L_Collapsed.xlsx.
//
@ws
ws / random_event.js
Created June 9, 2017 02:06
Find a random Facebook event (to bring yourself out of your comfort zone)
// Inspired by http://www.npr.org/sections/alltechconsidered/2017/06/08/531796329/eager-to-burst-his-own-bubble-a-techie-made-apps-to-randomize-his-life
// Literally all of the heavy lifting is done by https://github.com/tobilg/facebook-events-by-location-core
var EventSearch = require('facebook-events-by-location-core')
var es = new EventSearch({
"lat": 42.338998, // http://www.latlong.net/
"lng": -83.048520,
"distance": 250,
"accessToken": "YOURTOKENHERE" // https://developers.facebook.com/tools/accesstoken
@ws
ws / block_eggheads.js
Created May 6, 2016 19:05
Automatically block users with the default profile image (eggheads) who @reply you. Super simple. Will probably be expanded at some point if I have time.
var Twit = require('twit')
var T = new Twit({
consumer_key: '...',
consumer_secret: '...',
access_token: '...',
access_token_secret: '...'
})
var track = '@ws' // Also try 'trump'
@ws
ws / reply_percentage.rb
Created October 9, 2015 15:52
Calculate what % of your tweets are replies
require 'twitter'
client = Twitter::REST::Client.new do |config|
config.consumer_key = "YOUR_CONSUMER_KEY"
config.consumer_secret = "YOUR_CONSUMER_SECRET"
config.access_token = "YOUR_ACCESS_TOKEN"
config.access_token_secret = "YOUR_ACCESS_SECRET"
end
# https://github.com/sferik/twitter/blob/master/examples/AllTweets.md
@ws
ws / filters.json
Created March 8, 2015 19:10
Instagram Filters List (JSON)
{
"note": "I was mocking the Instagram API and couldn't find these anywhere, so I really quickly wrote a script to grab them. I think this is all of them, but no promises. Hopefully this saves you a few minutes.",
"filters":[
"Perpetua",
"Ludwig",
"Slumber",
"Aden",
"Crema",
"Charmes",
"Vesper",
https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/PUTSONGIDHERE&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false
@ws
ws / smtp.js
Last active February 19, 2016 14:48
var client = nodemailer.createTransport({
service: 'SendGrid',
auth: {
user: 'SENDGRID_USERNAME',
pass: 'SENDGRID_PASSWORD'
}
});
// See above
@ws
ws / keybase.md
Last active August 29, 2015 13:57

Keybase proof

I hereby claim:

  • I am ws on github.
  • I am ws (https://keybase.io/ws) on keybase.
  • I have a public key whose fingerprint is 70B7 5D32 E9CC 9686 F751 4749 B4DE C4A1 6B15 8330

To claim this, I am signing this object:

@ws
ws / Pushit.sh
Last active August 29, 2015 13:56 — forked from nquinlan/Pushit.sh
# in your .bash_profile / .bashrc
alias pushit='git push && open http://www.youtube.com/watch?v=vCadcBR95oU'
# to get the file into your .bash_profile
echo "alias pushit='git push && open http://www.youtube.com/watch?v=vCadcBR95oU'" >> .zshrc