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 python2.7 | |
"""To use: | |
First, run `pip install python-twitter` | |
Then, you'll need to create a twitter application at apps.twitter.com. This | |
will give you the API key & secret. Set its permissions to be Read & Write. | |
Then you'll generate an access token on the same page and put all four values | |
in the appropriate variables below. | |
Once that's done, just run ./twitter_autoblock_rts.py <some-tweet-id> |
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 | |
for f in `find ~/.ssh -perm 600 -type f` | |
do | |
add_key=true | |
for k in `ssh-add -l` | |
do | |
if [[ "$k" = "$f" ]] | |
then | |
add_key=false | |
fi |
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
# shitty | |
attributes[:name] = options[:name] unless options[:name].blank? | |
attributes[:first_name] = options[:first_name] unless options[:first_name].blank? | |
attributes[:last_name] = options[:last_name] unless options[:last_name].blank? | |
attributes[:linkedin_id] = options[:linkedin_id] unless options[:linkedin_id].blank? | |
attributes[:company] = options[:company] unless options[:company].blank? | |
attributes[:company_id] = options[:company_id] unless options[:company_id].blank? | |
attributes[:linkedin_picture_url] = options[:linkedin_picture_url] unless options[:linkedin_picture_url].blank? |
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 | |
if [[ -f /tmp/aliases.old ]]; then | |
rm -f /tmp/aliases.old | |
fi | |
if [[ -f /tmp/aliases.txt ]]; then | |
mv /tmp/aliases.txt /tmp/aliases.old | |
fi |
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
Public with sharing virtual class RestClient { | |
Public class RestClientException extends Exception {} | |
/* | |
* class variable creation - DO NOT EDIT | |
*/ | |
Public Map<String,String> headers; | |
Public String url; | |
Public String method; |
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
require 'pp' | |
module Helper | |
def capture(&block) | |
begin | |
$stdout = StringIO.new | |
$stderr = StringIO.new | |
yield | |
result = {} | |
result[:stdout] = $stdout.string |
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
# Simple bijective function | |
# Basically encodes any integer into a base(n) string, | |
# where n is ALPHABET.length. | |
# Based on pseudocode from http://stackoverflow.com/questions/742013/how-to-code-a-url-shortener/742047#742047 | |
ALPHABET = | |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789".split(//) | |
# make your own alphabet using: | |
# (('a'..'z').to_a + ('A'..'Z').to_a + (0..9).to_a).shuffle.join |
#How to download an MP3 track from a YouTube video You can also download the mp3 directly from youtube without converting using ffmpeg
youtube-dl --extract-audio --audio-format mp3 <video URL>
From the online help:
-x, --extract-audio convert video files to audio-only files (requires
ffmpeg or avconv and ffprobe or avprobe)
(Based on info from Peter Downs' gitub but with modified behavior to open a new terminal window for each invocation instead of reusing an already open window.)
The following three ways to launch an iTerm2 window from Finder have been tested on iTerm2 version 3+ running on macOS Mojave+.
pdanford - April 2020
OlderNewer