Share your programming projects!

Hey y’all, I know that there are similar topics, but I thought it might be nice to make a place specifically to share little programming projects that aren’t games! Maybe it’s a twitter bot you made, a web-tool, a neato website, a python script, your school project for reversing a string, or anything else you feel like sharing!

I recently got into programming outside of my job and started getting interested in making a twitter bot! I just figured out how to do it and made a bot that asks the important questions:


You can see it here

I also made a write-up to explain it and some surface level etymology of the term “woke.” And put the source code up here!

What sort of programming projects are you working on? Please share!

6 Likes

nice! I’m working on a fun dumb little side project myself that I’ll be more than happy to post once I put the finishing touches on it in a few days.

a quick note: you might want to remove the credentials.py file from github?

1 Like

it is filled with placeholders, unless I’m not seeing something others are seeing! It looks like this over here:

consumer_key = 'woke'
consumer_secret = 'woke'
access_token = 'woke'
access_token_secret = 'woke'

I was keeping it there so people could see how it works as I’m hoping to write up a tutorial!

(But thank you for warning me!)

2 Likes

It’s a shame this thread has been dead since February! I like the idea of a more general programming project thread, given the other is very game focused.

I recently made a little iOS app to brush up on my Swift (I’m primarily a mobile developer but i’ve been using Xamarin for a couple of years now so I was a bit rusty on the native stuff.) It pulls random quotes from Goodreads, shows you the book cover, title, author, average review score and then lets you add that book to your Goodreads shelves so you can read it later.

Or you can just share the quote as an image.

It’s up on the app store if anyone is interested in taking a look

And the code is on github

4 Likes

That’s cool! I feel like my partner and I could use that, we really suck at planning our meals :joy:
I share your pain about not being able to think up that many apps. I suck at coming up with ideas for side projects, my Quotey app is the first thing I’ve done outside of work for ages, outside of pushing some updates for a friend’s app.

1 Like

I was sick all weekend and used it as an excuse to finally do more work on my Quotey app that I shared before. I added a search function and commissioned an artist friend of mine to make a new logo for it. I’ve got some more plans to flesh it out a bit, which hopefully i’ll have time to do soon!

4 Likes

That’s really great! Nice work :slight_smile:

1 Like

Thanks! It has been a fun project to work on in my spare time. I have a giant to-do list for it, so hopefully i’ll have more time to work on it soon.

And for full credit’s sake, this is the person who I commissioned the Icon from. http://www.amiluu.com/

She’s great!

To come full circle to the original post, I also made a twitter bot!

I wanted to make a bot that would highlight the work animation professionals do on each individual frame of a finished work. So I made a script that exports all the frames out of a video and deletes any images that are near exact duplicates (just by a basic comparison of the colour values for each pixel). Then I made a bot that lives on google drive, slowly tweeting out all these frames every hour.

You can see the bot here:
https://twitter.com/AllTheFrames

I’ve started it off with an episode of Over the Garden Wall, which should get done in about 2 months. There’s a lot of frames to get through. :sweat_smile:

I’m surprised that stumbling onto the Google Drive solution made this a lot easier, because I no longer had to find a server to host my images as well as run the posting script. If anyone’s curious I can elaborate on how that all works, but the key thing is that you can add scripts to a spreadsheet, and then set up triggers that will run a function from your script at a regular time interval.

4 Likes

Yeah there’s a lot of cool stuff you can do with Sheets! I had found a script awhile back that let you setup an email filter where it would grab an email and save it as a PDF. Was really handy for emptying my inbox but still having copies.

I assume you were using Photos for the free storage?

2 Likes

I’d be interested in some more details or resources on using Sheets in the way if you have any on hand! I might be making another bot soon and it was enough of a nuisance to set up my previous one that I haven’t maintained it as much as I’d like.

Sure! I found this original doc as someone’s sample bot and just took a copy to modify for my needs:

Then for storage I was just using a google drive folder. Since the example script is embedded into a google sheet, it already has access to all the google drive tools I need.

Here’s what my modified section of code looked like:

function singleTweetButton(){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var image_ids = get_ids();
  var image = get_image_urls(image_ids);
  var tweet = get_tweet_text(ss.getRange("SendTweets!B7").getValue().toString(), image_ids);
  var reply = "";
  var err = ss.getRange("SendTweets!E7").getValue();
  var output = ss.getRange("SendTweets!F7");
  if (err) {
    ss.msgBox(err);
  } else {
    var newTweet = sendTweet(tweet, reply, image);
    output.setValue("tweet ID: " + newTweet);
  }
}

function get_tweet_text(base, ids){
  var tweet = base;
  for (var i = 0; i < ids.length; i++){
    if (i > 0) tweet += ", ";
    var file = DriveApp.getFileById(ids[i]);
    var name = file.getName();
    var suffix = name.split("_")[1];
    var number = suffix.split(".")[0];
    tweet += number.replace(/^0*/, "");
    file.setTrashed(true);
  }
  return tweet;
}

function get_image_urls(ids){
  var result = "";
  for (var i = 0; i < ids.length; i++){
    if (i > 0) result += ",";
    result += "https://drive.google.com/uc?export=view&id=" + ids[i];
  }
  return result;
}

function get_ids(){
  var folder = DriveApp.getFolderById("1sGk02tgkWDbkJJCnp4lCh5YLMxkvKkkB");
  var files = folder.getFiles();
  var file_list = [];
  while (files.hasNext()) {
    var file = files.next();
    file_list.push(file);
  }
  file_list.sort()
  var results = [];
  for (i = 0; i < 4; i++){
    if (i >= file_list.length) break;
    var id = file_list[i].getId();
    results.push(id);
  }
  return results;
}

So I was still using the underlying code to connect to twitter and make a post (with attachments), I just made functions that calculate the data needed for the tweet.

To explain some jiggery. Google Drive doesn’t seem to have a way to return a list of files, so I just had to iterate over them all and then sort the list, and then grab the 4 images I actually want to tweet. And to make it progress through the list without somehow saving state, I just delete the 4 images that have just been posted. That way every time it runs it can just grab the first 4 images.

And lastly I just set it up to run automatically by adding a trigger. From the script editor I went to Edit > Current project’s triggers. And from there I could just add a new trigger that’s time driven and runs the “singleTweetButton” every hour.

2 Likes

Ah! This is awesome, thank you for sharing! I might start tinkering with this over the weekend.

1 Like

Since this thread got bumped, figure I could give a bit of an update on my Quotey app!
I got a bit bored of the green gradient I’ve been using since the start and so started messing about with adding a screen to let users customise the colours. The initial plan was “Well i’ll have a few premade gradients because the library I’m using already has that built in” but then I thought “fuck it, why stop there?” and started playing about with adding colour pickers to let people fully customise the background.

It’s VERY work in progress, looks very silly and is not super functional atm and it may never make itse way into the live product but i’ve had fun trying to implement it if nothing else.

3 Likes

Getting there I think!

I’m just going to edit this post instead of bumping the thread again but i’ve since released an update to Quotey with these background colour modifications (and some bugfixse and so on.)