Skip to content

Instantly share code, notes, and snippets.

View zachwhalen's full-sized avatar
🥗

Zach Whalen zachwhalen

🥗
View GitHub Profile
{
"origin": ["this could be a tweet", "this is #alternatives# tweet", "#completely different#"],
"alternatives" : ["an example", "a different", "another", "a possible", "a generated", "your next"],
"completely different" : ["and now for something completely different", "so long and thanks for all the fish", "or, maybe, #alternatives# badger"]
}
@zachwhalen
zachwhalen / nn.sh
Last active June 2, 2018 16:47
A bash script to create and open a new text file with the appropriate header for a blog post in a Pico site.
nn() {
# the header template
ft="---
Title: Untitled Note
Template: blog-post
Description: New Note
Date: $(date)
Tags:
---";
@zachwhalen
zachwhalen / friday.py
Created December 16, 2016 14:32
A quick and clunky way to make one of those videos where it speeds up every time something happens. Uses MoviePy.
#/usr/bin/python
# use this script to make one of those videos where it speeds up
# every time something happens
# this has only been tested on a Mac with Python 2.7
# Also, moviepy is picky about codecs. What I have here seems to work
# (libxvid) but you may need to try something else
# Your mileage may vary
@zachwhalen
zachwhalen / botcode.gs
Created June 3, 2016 12:58
new doTweet function
function doTweet (tweet) {
var service = getTwitterService();
if (service.hasAccess()) {
var payload = {"status" : tweet }
} else {
var authorizationUrl = service.authorize();
msgPopUp('<p>Please visit the following URL and then re-run "Send a Test Tweet": <br/> <a target="_blank" href="' + authorizationUrl + '">' + authorizationUrl + '</a></p>');
}
var parameters = {
@zachwhalen
zachwhalen / out.pl
Last active August 29, 2015 14:26
Work in progress code for generating all possible panel layouts
#!/usr/bin/local/perl
#use experimental 'smartmatch';
no if $] >= 5.017011, warnings => 'experimental::smartmatch';
# Can I do this with 2x4?
# ##
# ##
# ##
# ##
#!/usr/bin/local/perl
for ($i = 0; $i < 10000; $i++){
$convert = `convert zen-jpg.jpg -resize 50% -quality 50 zen-jpg.jpg`;
$convert = `convert zen-jpg.jpg -resize 200% -quality 50 zen-jpg.jpg`;
}
#!/usr/bin/local/perl
# a quick and dirty numeric syllable counter
use Number::Spell;
@one = qw/one two three four five six eight nine ten twelve/;
@two = qw/seven thirteen fourteen fifteen sixteen eighteen nineteen twenty thirty forty fifty sixty eighty ninety hundred thousand million billion trillion/;
@three = qw/eleven seventeen seventy/;
@zachwhalen
zachwhalen / gist:36ff9caade7294606079
Created September 16, 2014 14:40
basicallytopgun.pl
#!/usr/bin/local/perl
use Net::Twitter;
$prefix = '/home/zach/Software/pg/power';
# make a list of all the frames
@frames = glob "$prefix/frames/*.png";
# select the first one from that list, to be tweeted.
@zachwhalen
zachwhalen / Question.md
Created March 5, 2014 21:34
A question

Hello,

I have inquiry that is too long to tweet, too technical for facebook, and I wouldn't know who to email it to. So I'm posting it here as a gist in the hope that it can reach someone who might have an answer or suggestion to the problem I'm trying to solve.

The problem is this: I have a Google Apps script scraping for content to add to amillionbluepages.net. I'd like for it to tweet whenever it finds and ingests something new, but I don't know how to make that work reliably.

For now, and this isn't working, I compose a tweet text in the script, append that text as a cell on a google spreadsheet, and then I have an If This Then That recipe checking the RSS feed generated by that spreadsheet. The problem is, IFTTT can't always read those new cells because Google Spreadsheets doesn't output consistent or valid RSS. I'm not sure what's going on there.

The other option I know of would seem to be easier: send tweets directly from the Google Apps script. That would be great, except for a Google Apps bug th

@zachwhalen
zachwhalen / botcode.pl
Created February 28, 2014 22:57
This is a slightly cleaned up version of the code that runs @rom_txt. It's pretty simple -- it just loads a big text file and picks a random few lines.
#/usr/bin/local/perl
use Net::Twitter;
use Data::Dumper;
use LWP::Simple;
# get API credentials at http://dev.twitter.com
my $nt = Net::Twitter->new(
traits => [qw/API::RESTv1_1/],