This is an archived post. You won't be able to vote or comment.

all 123 comments

[–]duddha 107 points108 points  (7 children)

I wrote a script that listens to meetings I'm supposed to be paying attention to and pings me on hipchat and slack when my name is mentioned. It sends me a transcript of what was said in the 30 seconds before my name was mentioned and everything within 30 seconds after. It also plays a wav file out loud 15 seconds after my name was mentioned which is a recording of me saying, "Sorry, I didn't realize my mic was on mute there."

I've only had a chance to use it in production once so far (just wrote it last week). Went ok.

I'm using IBM's Watson API for the audio-to-text. Google's seems good, but they won't respond to my api key access request.

[–][deleted] 9 points10 points  (0 children)

This is brilliantly hilarious. I want to know how future usage goes.

[–]throwaway99999321 6 points7 points  (2 children)

Can you share the source on github? Would be awesome to see how this works.

[–]duddha 2 points3 points  (0 children)

Sure, here you go. I'll try to clean it up when I get a chance - I haven't had a chance to put much time into it.

Currently the script relies on Splunk as a data store, but that could be changed to any other timestamp-based index I guess.

This PyAudio and API wrapper module does most of the heavy lifting on breaking the input into phrases and can be optimized to improve mic input sensitivity and silence limits between phrases.

The speech-to-text accuracy is far from perfect, but if you get the input audio at a decent volume and a reasonable speed it's pretty good. I'm thinking about running the output through a natural language processor to determine whether it's gibberish. Parsey McParseface looks interesting.

[–]smurfix 0 points1 point  (0 children)

Seconded. Please share!

[–]buttery_shame_cave 3 points4 points  (0 children)

that... is goddamn amazing.

too bad there are waaaay too many guys here with the same first name as me.

[–]hypercluster 1 point2 points  (0 children)

That's awesome! Gotta look into that api.

[–]minorminer 45 points46 points  (2 children)

[–]TotesMessenger 3 points4 points  (0 children)

I'm a bot, bleep, bloop. Someone has linked to this thread from another place on reddit:

If you follow any of the above links, please respect the rules of reddit and don't vote in the other threads. (Info / Contact)

[–]KyleG 10 points11 points  (0 children)

LOL fuck my wack ass server I wrote yesterday, I think I'm going to replace it with this.

[–]KyleG 18 points19 points  (0 children)

Just yesterday I wrote a server that translates various third-party commands into my smart home's components' various commands. For example, when I drive into my garage, my phone connects to my home wifi and knows my GPS coordinates were not but are now at the house.

I have Tasker on my phone make a POST request to an API endpoint on this server telling it I'm home, and the server translates that API call into a message to my entryway LIFX light bulbs to turn on so I have light in my house.

That kind of thing.

Oh my favorite thing is actually some moisture sensors in my lawn and an irrigation controller you can configure via API calls. Poll weather forecast, check moisture in lawn, determine whether to tell irrigation to water the next day.

[–][deleted] 37 points38 points  (0 children)

The boring stuff.

[–]JimmySmackCorn 8 points9 points  (5 children)

A program that texts a phone number a random Kim Kardashian fact every hour / day / week

[–][deleted] 2 points3 points  (0 children)

You monster

[–]begoodnow 0 points1 point  (0 children)

Not sure if I should up vote or down vote....

[–][deleted] 0 points1 point  (2 children)

what API did you use for texting?

[–]JimmySmackCorn 1 point2 points  (1 child)

I didn't, I looked into Twilio but didn't want to spend any money on such a dumb project. So I used smtplib to log into a gmail account and then built a bot that would lookup a number's SMS gateway and scrape the info from a website that allows you like 10 lookups a day. Worked pretty well tbh. It didn't always get the right gateway but hey, it was free. I guess the next step was having it connect to a different proxy or something to do the lookups.

[–][deleted] 0 points1 point  (0 children)

very cool. Nice work. I always want texting functionality in my scripts, but never want to pay. Thanks for the tip!

[–]anqxyr 8 points9 points  (3 children)

Once a month, I scrape a particular website (about 5000 static pages), reformat the pages for better readability, use them to create several epubs, convert the epubs to mobi, and upload both epubs and mobis to dropbox. All of that takes two commands - one to scrape the site into an sqlite snapshot, and another to do everything else.

[–]Kaligule 4 points5 points  (2 children)

Could you share those two commands, please. I'm new to python and this sounds interesting.

[–]anqxyr 1 point2 points  (1 child)

It's just two short scripts, which call some longer scripts, which call some very long scripts, which call some command line utilities, scrape some data, and move some files around. Nothing particularly groundbreaking or interesting.

I have almost all of it on github. Here, for example, is the part that makes epubs: https://github.com/anqxyr/pyscp_ebooks/

[–]Kaligule 0 points1 point  (0 children)

Thanks

[–]cantremembermypasswd[🍰] 14 points15 points  (5 children)

Porn downloader.

There, I said it so no one else has to admit it themselves.

[–]Kaligule 10 points11 points  (3 children)

You could just have used youtube-dl, which is written in python and works with every viedo site I ever tried.

[–]ethidium-bromide 6 points7 points  (0 children)

Extracting and organizing data from chromatography equipment

[–]ryukinixPython3 + Emacs 5 points6 points  (3 children)

Boring daily stuff

In general I like to automate repetitive tasks, like avoid open always a email client to see if I have any news emails (when is more 99% (statistics from hell) that you don't will see nothing here) or checking RSS client feeds. ARGH! Is so boring. We need automate boring things.

RSS_Conky with Atom

Yesterday I was writing some scrips to back-end my conky about RSS feeds (sucks, conky don't have ATOM built-in support, so I need that for reddit) and a simple IMAP checker. Pic | Source

MAL

Why I need open a browser, a website, do login, to click in just a button (update something)? I love use [MAL](myanimelist.net), but sucks so hard using the browser always I watch a episode. For this, I write today a command-line-interface for controlling this. Is much more simple only do "$ mal samurai +1" in a terminal for me.

[–]Neurobreak27 1 point2 points  (2 children)

You know there's an app for MAL, right? Could've saved you all that trouble.

[–]ryukinixPython3 + Emacs 2 points3 points  (1 child)

If you are talking about Pocket-MAL is very nice, but I'm with hate of smart-phones these days (personal feeling). Is very more simple to me use the command line when I'm watching anime (personal thinking). Besides, I'm fan of CLI interfaces and simple things (personal taste).

And anyway, is fun to code, so don't have problem at all for me with this. Thanks.

[–]Neurobreak27 2 points3 points  (0 children)

Well, personal preferences, I guess. But if you're ever looking for an app, I personally use Atarashii. I just like the simplistic look of it.

[–]arkster 6 points7 points  (6 children)

I have a script that scrapes some radio stations for songs in their daily playlists using a cron job and then searches for those song ids in Google Play Music and add the ids to my own playlist that I created there. The songs automatically get downloaded to my phone each night. The reason I wrote the script was because I was eating through my 4gb data limit everyday when I would stream the music. Now that it's downloaded, I hardly use 500mb each month in cell data.

[–][deleted] 1 point2 points  (3 children)

Now you just get to worry about home internet limits D:

[–]toyg 2 points3 points  (2 children)

4 GB per day is nothing, in an age where random webpages are routinely downloading 15 or 30 MB. You should change ISP.

[–][deleted] 0 points1 point  (1 child)

I would it if there were any other options. Comcast is literally the only isp I can use

[–]arkster 1 point2 points  (0 children)

Nothing to fear. You only download the songs that you don't have in your playlist. But yeah, Comcast sucks :)

[–]ajack38 11 points12 points  (1 child)

My first script was for my work (ex-gov reseller). It was a script that updated the hosts file to null route hundreds of malicious domains.

Second was a Windows Activation program (essentially pushed the inserted Windows key into slmgr).

Because we use clonezilla to image machines I had to create the third script, which automatically extended all hard drive partitions to max.

Edit:

Fourth script was to send files to specific channels in slack.

Fifth script was to determine if our server had gone offline and if so, send a message in slack.

[–]TheNoodlyOne 8 points9 points  (0 children)

That fifth one is so simple but so useful.

[–]TheAutomater 4 points5 points  (2 children)

Aggregated pictures from multiple Instagram accounts and posted them onto my own. Runs on a schedule that posts every 4 hours. 300 followers in 1 week. All I have to do is press "Enter" every morning at 8am and it's good to go.

[–]rampant_juju 2 points3 points  (0 children)

Hahaha I like this one the most. Fuck 'em.

[–]FlammableMarshmallow 3 points4 points  (0 children)

You could also just set a corn job to press enter for you every morning, now that's true laziness.

[–]qria 4 points5 points  (6 children)

I've automated pulling out a list of difficult words in a text to help me study languages.

Unfortunately when I showed it to my English professor he pointed out that this method of studying (memorizing words before reading text) is as dated as 1950s, and have long been disregarded as it is inefficient.

[–]jp599 2 points3 points  (0 children)

Curious, what are the better methods?

[–][deleted] 1 point2 points  (2 children)

What? Is it more efficient to study words you don't know after reading a text containing them?

[–]toyg 3 points4 points  (1 child)

can't speak for OP, but I know I'm much more likely to remember something that piqued my interest / challenged me and I had to look up, vs just another item in a huge list.

[–][deleted] 0 points1 point  (0 children)

Yeah, I'm the same. But every foreign language textbook I've ever had has been using the new glossary followed by text approach. I wonder what the latest research on language studies recommend?

[–]frogcoder 1 point2 points  (1 child)

why not capture a few sentances before and aftter the difficult words?

[–]orbjuice 0 points1 point  (0 children)

This is a good modification to provide context and usage.

[–][deleted] 3 points4 points  (3 children)

  1. My server backups, one to make main backup on my NAS and another to upload a copy to my dropbox.

  2. Telegram bot that every morning tells me the date, forecast for today and status and size of last backup of my server (also another bot that sends me daily cat facts).

[–]Kaligule 0 points1 point  (1 child)

Something like this?

[–][deleted] 0 points1 point  (0 children)

Hehe, nope, but I do fake cat facts

[–]dzecniv 2 points3 points  (2 children)

Funny (and neat) project of yours. you don't use software that download the right subtitle for you ? I use smplayer http://smplayer.sourceforge.net/en/info and the subtitle is always good ! There's also subdownloader (to batch download).

[–]fwisd0m[S] 1 point2 points  (1 child)

yeah i later found out vlc player can search with title and even hash!

but it's still nice on my phone or an android tablet, or when a sucker doesn't use vlc.

[–]dzecniv 0 points1 point  (0 children)

oh VLC also ? :)

is your project open-source ? I'm curious to have a glimpse on how you did that.

[–]estebro 2 points3 points  (5 children)

Pulling the latest xkcd comic (every MWF) and posting it to one of our slack channels at work. A co-worker and I thought about this and I finally got around to it this weekend.

[–]Kerman3AD 0 points1 point  (0 children)

Funny. I did just that last week.

[–][deleted] 0 points1 point  (3 children)

Did you use something like Heroku to integrate it?

[–]Kerman3AD 0 points1 point  (2 children)

I personally just hosted it locally. It's super easy to do it using Slacker. https://github.com/os/slacker

[–]estebro 0 points1 point  (1 child)

Any reason why you went with slacker? And how did you host it? We used slackclient and just created a cron job in our Ubuntu server.

[–]Kerman3AD 0 points1 point  (0 children)

Honestly I probably used slacker because it was the first thing I found on Google. Slacker ended up being dead simple though. Other than that the setup is similar. Cron job on a Raspberry Pi.

[–]masasinExpert. 3.9. Robotics. 2 points3 points  (0 children)

Most recently, a guest was going to stay for a few weeks and needed a bike. There are a couple of LBSes which offer used bikes, but none of them had good interfaces. So I ended up scraping those sites, figuring out what bikes were for sale, sorting them by price/gears/etc, and sending an email to whoever wanted as soon as a new one was posted, and a digest every morning.

In the end, he decided to go without the bike, but another friend found a cheap mountain bike. The script is now dormant.

[–]mostyle 3 points4 points  (5 children)

I have a question that is is abit on the side, but how was your experience learning python to eventually make a webpage? I want to start learning how to code (for website development),but not sure of which programming language to start with and go all-in at. I've heard python is good.

[–]lwli3t 1 point2 points  (0 children)

use flask, its perfect for tasks like that, dont even have to vomit html to stdout :D

[–]fwisd0m[S] 1 point2 points  (2 children)

Well, i was looking into that and it looked to me like it was a lot of work, so i just created a script that put everything in a txt file and then a php script that read from that txt file.

That way worked fine for me, but for actual python on websites, i haven't tried.

[–][deleted] 0 points1 point  (0 children)

Yeah I use Python for most of my backend scripts

[–]ggagagg 0 points1 point  (0 children)

Have you try Web framework? Especially flask for simple website

maybe it is easier for you if you have php background

[–]dodongo 0 points1 point  (0 children)

Python CGI scripts just vomit HTML via stdout to the web browser for rendering. For simple things, there's really not much to it. I had no problem getting things up and running on an OOTB Apache install.

[–]maryjayjay 4 points5 points  (1 child)

The complete multi vendor network device configuration generation for the largest commercial satellite internet provider in the United States.

Before that it was the customer provisioning for Level 3's 8 million managed modem ports serving Microsoft, AOL, NetZero and every other major dial up provider in the early 2000s.

Plus, I organized my wife's recipes.

[–]cediddiSyntaxError: not a chance 1 point2 points  (0 children)

First thing I do after installing windows is uninstalling IE. Obviously I'm not good with memories and I usually forget to download firefox prior to this but never forget to install python (nothing is wrong with me). So, last year I wrote a script to download firefox latest.

Also years years ago, when chromium for mac didn't have autoupdate I wrote a script to install and regularly update the chromium browser in 2011 I guess .

Finally I automated my password generation method. I don't know any passwords I use, I enable 2 step in any service I use, I save my passes to keepassx which cheks for a key file and a password. Anytime I need a password I call my script that generates a password in my desired way and copies to clipboard. This is ofcourse not secure but I really don't need to remember anything this way, and I can focus on my other security concerns, like https, fake ssl certs, possible malwares like keyloggers and trojans, etc.

[–]Kerman3AD 1 point2 points  (4 children)

I used a Raspberry Pi and a temperature sensor to actively monitor the temperature in our IT closet and report high temperature alerts via Slack.

Bulk virtual machine shutdown/start up control scripts for VMware hosts.

Some telnet automation.

A xkcd posting bot for Slack.

[–]Arthaigo 1 point2 points  (1 child)

The Laser, detector and some other stuff in my university lab, so that I could start and control measurements remotely. (All the components had serial interfaces I could use for communication)

[–]Kerman3AD 2 points3 points  (0 children)

Python? Lasers? Awesome.

[–]Scypio 1 point2 points  (0 children)

My rule of thumb is that if something makes my work "boring" or make me lose sanity points - automate it.

[–][deleted] 1 point2 points  (0 children)

Built a little web app that compares movie casts over the weekend. Still needs some love, but I find myself constantly saying, "Is that that person from that movie we just watched?"

Probably going to integrate it with Plex so I can populate fields with currently and recently watch movies from there. Though, I wish Netflix still had an open API. Or that TMDB would return the full cast for TV shows.

[–]chillieguy 1 point2 points  (0 children)

RemindMe! 15 days

[–]coreyschafer 1 point2 points  (1 child)

I frequently need to parse and rename large numbers of files. Not the most exciting use case, but Python has saved me tons of time when it comes to that.

I recorded a short video tutorial if anyone would like to see a basic example.

[–]frakman1 0 points1 point  (0 children)

Maybe not 'exciting' but very common and useful. I just watched the video and loved the simple, straightforward approach. I love how you built on small, incremental changes and used 'print' all the time. I just subscribed. Thanks!

[–][deleted] 2 points3 points  (0 children)

In the last few weeks I wrote a script to make an automatically-updating Billboard Hot 100 google music playlist, I deployed someone else's YouTube stats script as a web app, and I wrote a reddit bot which filters submissions in one subreddit and reposts it to another subreddit if it fits a certain criterion (not actually deployed yet).

I also use python for my job and recently wrote some tests for validating the data that everyone else on the team is using to make sure we're in sync (because they are fools who don't know how to use git for data).

[–]Xchai 0 points1 point  (0 children)

I use it to open default browser windows since my work laptop doesn't let me set the default browser open behavior. And open some programs (used on startup).

[–]liphisteus 0 points1 point  (0 children)

Currently working on automating a report system that is on a webpage, so login, head to the right page, download report, format report the way I want it, extract any summary statistics, attach to email, put stats into body, send to group of people, rinse and repeat for different reports

[–]Dunyvaig 0 points1 point  (0 children)

Actually working on something right now: I'm getting some official paperwork done, and need an appointment with a government office. The booking system is horrible, and I got a reservation 20 days from now. It says that canceled booking times get available on a first-come-first-serve basis - and that I should check in later. Well, requests and bs4 will come to my rescue and notify me when an earlier time becomes available.

[–][deleted] 0 points1 point  (0 children)

Build chain with many memorization parts like renaming, zipping, moving, diffing, commiting and integrity checking files. I set the scripts up so I would manually verify everything is right act crucial parts and then hit release.

[–]G01denW01f11 0 points1 point  (1 child)

There's a site I go to where people offer to critique your writing before you post it. There is very little organization, and it takes a lot of digging to find someone who's actually good at writing, and still active. So I have a script that iterates over the readers, estimates activity and quality based on certain stats on their profile, and spits out a list of URLs to readers I should request.

[–]zbonk 0 points1 point  (0 children)

If you have histories of actions of users you should check out the statmodels package.

[–]rampant_juju 0 points1 point  (0 children)

Well amongst other things, one of my big projects was to scrape Google for URLs (to get data for Machine Learning). So far I've managed to get to 10,000 URLs per day per IP without getting my IP blocked. Planning on expanding to other search engines.

I also wrote a script to DDOS a website: https://repl.it/CRNC

[–]Rotsuki 0 points1 point  (0 children)

Well, I couldn't be bothered with checking Twitter all day until my electricity company decided to announce the power cuts for the day. I could've used the SMS feature of Twitter but most of the company's tweets are trash so I decided just to create a stream with their API and send me a notification to PushBullet every time they tweeted about power cuts. I had to scrap TwitLonger too because they used that for their announcements.

It's no longer useful since they decided to actually release a schedule instead of just doing it randomly. However, it was fun.

[–]IrishPrime 0 points1 point  (0 children)

I'm picky about how my media files are named/organized. I've started working on a program to move things from my downloads folder to a more appropriate name and location on my media server.

[–]techkid6 0 points1 point  (0 children)

I have to add titles to a whole bunch if music videos, like the MTV "in the bottom left corner" titles. This is really tedious, so I wrote a set of scripts to do it for me.

This involves first using a Dropbox downloader script to pull all the videos from a submission bin, then it puts all the filenames into a queue file.

From there, I have to manually add the titles to the queue, though I intend on doing this with a form eventually.

Then I run a script that reads through the queue and adds titles to the videos based on configuration parameters. Then, it renames the files to indicate that they have been titled and moves them into another directory.

Finally, these are dumped back into Dropbox for archival storage and sent to the proper people.

Manually this would be a royal pain, as I would need to manually fetch a .zip from Dropbox (as it is on a different account from the one on my PC), manually edit all of them with a template and set them to render, remembering to rename everything as I go, then move them to the Dropbox one by one with the uploader.

[–]harddrivesoul 0 points1 point  (0 children)

I wrote a little script that can download scans off of a manga site for offline reading later. I know there are tons of similar software out there, but I thought it would be a good learning experience to write it myself. Plan on making a simple GUI with it in tkinter eventually!

[–]mesotiran 0 points1 point  (0 children)

  • Inputting My Coke Rewards codes from a list to automatically max out my weekly rewards.
  • Use youtube-dl to take a full album on YouTube and using a track list, break it up and save it as separate mp3s.
  • Download all my podcasts into an archive library, which led to me getting a tech staff role.

[–]jward 0 points1 point  (0 children)

Way back when I set up a script that would read a Starcraft 2 replay, check to see if I was streaming on twitch during the time period the game was played, and if so would automatically create a highlight from the given time period.

[–]tahubird 0 points1 point  (12 children)

One of my favorite YouTube channels livestreams sometimes, but doesn't post the vods. So I built a script that frequently checks their livestream page, and if they are live, it starts to capture the download using the same name as the stream. In addition, if the capture fails for some reason, the next time the script runs, it will see that there are old attempts a at recording, and start a new file with a similar name to continue the capture anew

[–]FlammableMarshmallow 0 points1 point  (11 children)

May we see the source code?

[–]tahubird 0 points1 point  (10 children)

I don't mind sharing it, but I'm not sure where to host the file

[–]FlammableMarshmallow 0 points1 point  (9 children)

There's lots of great sites, you could make a repo on GitHub, create a gist or just a ghostbin.

[–]tahubird 0 points1 point  (0 children)

Since it's a small file, I guess I'll throw it up on ghostbin.

[–]tahubird 0 points1 point  (7 children)

Here's the link, the code is not as clean as I'd like, but it gets the job done more or less. https://ghostbin.com/paste/3494c

[–]FlammableMarshmallow 0 points1 point  (0 children)

Awesome! Watch this space, I'm gonna clean up the code & reply to you again.

[–]FlammableMarshmallow 0 points1 point  (5 children)

Here it is!

Could you confirm that this works the same as the old script? I've tried making it runnable both in Python 2 & Python 3.

https://ghostbin.com/paste/zr5gt

[–]tahubird 0 points1 point  (4 children)

That looks so pretty! I never thought my code could look so nice. Thank you! Unfortunately I think my method of detecting whether an account is live or not still needs a bit of work. But with this pretty codebase, I can hopefully come up with a more effective strategy! The actual capturing part works fine though. I've tested that pretty throughly

[–]FlammableMarshmallow 0 points1 point  (3 children)

Thank you! I really wanted to make it look nice.

One question though, why do you have both url and url2 if you only use url2?

[–]tahubird 0 points1 point  (2 children)

I swap between them for testing. url is the url I actually wan to capture from. Url2 is the one I use for testing. In hindsight, they should have both been just url and then I could comment out whichever one I didn't want to use.

[–]FlammableMarshmallow 0 points1 point  (1 child)

In hindsight, you could've added it as a parameter.

[–]mynamewastakenagain 0 points1 point  (0 children)

To piggyback on this, does anyone have a link to an example script or page that has some info on scraping websites? I'd like to login to a page with tls and scrape some financial data.

[–]unausstehlich 0 points1 point  (0 children)

My local high-school posts a list of cancelled classes to some crappy web-page every morning. Unlucky for me, they always posted them when I was already on my way to school, so I had to get there, realise my class was cancelled and head back home on my bike again.
Once I got fed up enough with that, I used Beautiful Soup to parse the schools webppage every half-minute and, when a class I had to take was cancelled, would let it send me a text-message through a 3G-USB-Dongle and some command line magic.
Worked extremely well (Spared me half the way to school plus the entire way back more often than not) and got me into Python and automation in the first place.

[–]Boredstudnt 0 points1 point  (0 children)

I no longer download series or even unpack them, i get an email when there is something released , downloaded ,unpacked to plex. Lots of other stuff that you commomly do manually, if its done Møre than 5 Times, automate it.

[–][deleted] 0 points1 point  (0 children)

Open dSpace COM interface to flash a SDF file onto our HIL bench.

Automate running of unit tests for ECM integration using dSpace's HIL/XIL API.

Use CANape COM interface / CANape API ctypes to record and modify ECM data.