[HN Gopher] Some tiny personal programs I've written
       ___________________________________________________________________
        
       Some tiny personal programs I've written
        
       Author : atg_abhishek
       Score  : 474 points
       Date   : 2022-03-09 14:19 UTC (8 hours ago)
        
 (HTM) web link (jvns.ca)
 (TXT) w3m dump (jvns.ca)
        
       | jrm4 wrote:
       | My dream in life, seriously, is to get waaaay more people doing
       | this sort of thing than they do now. If STEM is worth anything,
       | it would be worth things like this*
       | 
       | *(I run a STEM non-profit, so I feel pretty qualified to
       | criticize it this harshly)
        
       | markussss wrote:
       | I absolutely love this, and I do the same. Small programs and
       | scripts to solve problems I encountered in my daily life. When I
       | make them for my own use, and for myself to enjoy making
       | something, I don't care about whether it's the best solution or
       | the most elegant solution, as long as it's _a solution_! And I
       | really, really enjoy that. I don 't care if it's one or one
       | hundred lines, as long as it's enjoyable!
       | 
       | A few of my examples are:
       | 
       | 1. A PyQt GUI for redshift. I use this every day, and have been
       | for a few years.
       | 
       | 2. Userstyle for horizontally flipping a video. Sometimes a video
       | or stream is mirrored, for some reason, and it's just _nice_ to
       | be able to fix it.
       | 
       | 3. Userstyle for scaling videos that originally had an aspect
       | ratio of 4:3, but have been stretched out into 16:9 back to the
       | original 4:3 aspect ratio. It's surprising how often you come
       | across those.
       | 
       | 4. Userscript for improving the functionality of the investment
       | portal of my bank.
       | 
       | 5. Bookmarklet for opening all videos on the page in new tabs,
       | but there are some problems with iframes yet.
       | 
       | 6. Bookmarklet for setting playback speed of videos on the
       | current page. I use this several times per day.
       | 
       | [1]: https://github.com/Markussss/redshift-gui
       | 
       | [2,3,4]: https://github.com/Markussss/userscripts
       | 
       | [5,6]: https://markussss.github.io/
        
       | wwilim wrote:
       | > I don't think it actually helped but it was fun
       | 
       | This seems like the central theme, and I can totally relate
        
       | nivethan wrote:
       | Julia writes so nicely, something about the way she talks about
       | projects and things is so earnest. I have a brag document because
       | of her and it's helped quite a bit. I have my own list of toy
       | projects and I think it's good to track them especially to find
       | code examples later!
       | 
       | https://nivethan.dev/projects.html
       | 
       | I really liked writing a http server in bash because I started
       | just to see if I could. I also really like my project to get the
       | top reddit stories from each country.
        
       | ludovicianul wrote:
       | It's fun to build simple stuff that work, but it's even more
       | rewarding to build stuff you actually use every day. I made a
       | simple expense tracker that will parse the SMS messages I get
       | from the bank when paying for stuff, categorise based on merchant
       | categories and push it to a google spreadsheet for traceability
       | and visual charts. Good opportunity to play with building native
       | images (it's done in java) in order to minimise resource usage as
       | it's deployed in a 5$ digital ocean droplet. 10 years ago I've
       | built a Swing app to generate invoices in a local compliant
       | format. It was great to flexibility to customise everything.
        
         | psalminen wrote:
         | I did the same thing. I use a twilio number that calls a GCP
         | cloud function. Super handy utility, and I haven't had to pay a
         | dime for it.
        
       | aghilann wrote:
       | If any of you know don't know what LaTeX is, it's a way to write
       | documents, it's usually used to write Math and Science research
       | paper's because the of the formatting and symbols LaTex allows
       | for. It has a lot of flexibility, but everything in LaTex
       | requires a lot more effort to type then in something like MS
       | Word. I have to use it for a class I'm currently taking where you
       | have to do super long proofs, I created a short 50 line script
       | where I can enter a mathematical expression using plain text and
       | shorthand's for special symbols and the function returns a string
       | I can copy and paste into LaTex. Saved me and my groupmates
       | multiple hours, I also posted on my class forum so I can save my
       | classmates the pain as well.
        
         | arendtio wrote:
         | You might want to check out those blog posts:
         | https://castel.dev
        
         | generalizations wrote:
         | Might be worth looking into Lyx also. It's a sort of WYSIWYG
         | for latex.
        
         | version_five wrote:
         | I have to disagree with you about LaTex being slower than word
         | for equations. In fact, one of the big reasons I started using
         | it was faster equation typing. And when word2003 was upgraded
         | to 2007 or whatever came next, they actually changed the
         | equation editor to allow latex style entry so you didnt have to
         | click through the menus to get symbols.
         | 
         | What kind of shorthand do you use with your script? I honestly
         | find latex's shorthand already short.
        
           | aghilann wrote:
           | The course I'm currently taking makes me uses symbols like
           | the biconditional, xor, and quantifiers. Each symbol requires
           | an entire word to type out but I also frequency have to look
           | at a reference sheet to find the command for each symbol. I
           | just use short hands like "-" for not, "and" for $\land$,
           | etc. I'm sure if I used LaTex more often, I would have most
           | of the commands memorized but I use it infrequency so I
           | almost never remember.
        
             | hegzploit wrote:
             | I'm pretty sure you can create macros in LaTeX, not sure If
             | this would solve your problem.
        
         | xmprt wrote:
         | I wonder if you could make a few minor tweaks so it's a latex
         | plugin and you can skip the copy and paste process.
        
         | froh wrote:
         | Here is relatively recent collection of tools and tweaks to
         | quickly create math in LaTeX, quick as in: live transcribing
         | class notes.
         | https://www.reddit.com/r/LaTeX/comments/ieonbz/using_latex_f...
        
         | hereforphone wrote:
         | I don't think there are any engineers (people who have gone to
         | engineering school) that haven't used LaTeX. [Editing based on
         | replies]: Apparently I am wrong. Maybe it's just at the grad
         | school level that one can expect to use LaTeX frequently; I
         | made the assumption because I took a Master's.
        
           | pitaj wrote:
           | Checking in as a BSEE: never used LaTeX.
        
           | pushrax wrote:
           | It's more common in CS than engineering in my experience,
           | when CS is part of the math department.
        
           | Jtsummers wrote:
           | You're very optimistic. I doubt anywhere near the majority of
           | engineers have used LaTeX directly. I've seen a lot more (of
           | all ages) who used Word for their technical writing. If they
           | used LaTeX or TeX it was a one-off, not something they became
           | skilled with.
        
         | avg_dev wrote:
         | If you put it on GitHub, or anyone linked me to a similar tool,
         | I'd be interested. Thanks.
        
           | vulcan01 wrote:
           | This is not exactly the same thing, as it just renders the
           | output, but the following uses markdown and asciimath for
           | quick math notetaking.
           | 
           | https://vedthiru.com/tools/notetaker
           | 
           | Disclaimer: I wrote it.
        
             | aghilann wrote:
             | This is pretty cool, similar note taking service called
             | Obsidian I use to take notes in Markdown
        
         | Minor49er wrote:
         | I recently came across a zine someone made called The Codex:
         | Life with Linux. It's on Etsy for $6 [1], but their short
         | chapter of LaTeX tips is fully shown in one of the screenshots
         | [2]
         | 
         | [1] https://www.etsy.com/listing/1099735271/the-codex-a-zine-
         | abo...
         | 
         | [2]
         | https://i.etsystatic.com/9756188/r/il/09766b/3387078510/il_1...
        
       | fmakunbound wrote:
       | > use secret undocumented APIs where you need to copy your
       | cookies out of the browser to get access to them
       | 
       | Yea, thank you modern front end developers. This is my favorite
       | start for scraping as well.
        
       | JamesMcMinn wrote:
       | I own the house I currently live in because of a script I wrote.
       | 
       | We had been looking for a new build for some time and had settled
       | on a development and specific house we wanted to buy, but it was
       | still months away from being released. We were told they released
       | houses in person first, then listed them online later that day,
       | but I was bored and wanted to see when new houses were listed, so
       | I wrote a scraper to alert me whenever a new house became
       | available.
       | 
       | One day, we got a call from the property developer telling us the
       | house we were interested in would be available in person from
       | 10am the next day. Because we wanted to be certain to get it, we
       | appeared at 8am, only to find that 3 other people were already
       | waiting. Houses are released in batches of 2 or 3, so whilst we
       | weren't hopeful, we joined the queue and waited.
       | 
       | At 9am, while waiting in line, I got an alert telling me that the
       | house had been released online, so I open their website on my
       | phone and paid the deposit.
       | 
       | At 10am, when the sales office opened, all hell broke loose as
       | the person first in line (waiting since 5am...) discovered the
       | house they wanted had already been reserved online. I'd
       | effectively stolen his house. It was awkward to say the least as
       | all of us were crammed into a tiny portacabin while this
       | unfolded.
       | 
       | In truth, I felt awful for depriving him of the house he and his
       | family wanted, but relieved that we had reserved the house we
       | wanted after a 5 month wait. A few weeks later the developer got
       | in touch to say that they had changed their policy nationwide and
       | would only be releasing houses online in the future because of
       | "the incident"...
       | 
       | Whilst I wasn't willing to give up our reservation, I worked with
       | the person who had wanted our house so that they were alerted
       | whenever a similar house in the same development became
       | available. He got one, there's no hard feelings, and him and his
       | family are now my next door neighbours.
        
         | jwong_ wrote:
         | Did you end up running the scraper longer for your new
         | neighbour?
        
           | JamesMcMinn wrote:
           | I did, yes. I set it up with some specific conditions that
           | sent him an alert whenever a house similar to ours became
           | available. In the end, he got the house directly next to ours
           | and very similar in design.
           | 
           | Our garages actually share a wall.
        
             | jwong_ wrote:
             | That's really kind of you to run that scraper for him as
             | well. Glad it all worked out~
        
         | recentrecruit wrote:
         | Reminds me of "Project Thor" from my university days. Course
         | registrations were online, but in phases, e.g. Seniors for a
         | week, then Juniors for a week, and so down the line.
         | 
         | However, many students would snag a spot in a course only to
         | drop it as they shuffled courses around. There existed a
         | "queue" for the overflow, but it appeared to work as a CRON job
         | or otherwise involved a human in the loop as one would
         | routinely see:
         | 
         | Spanish 102 (Registered: (29/30), Queued:(60))
         | 
         | While in this state, one could simply click on the course and
         | register, completely bypassing this poorly designed queue. So,
         | naturally, I wrote a script to scrape the site on once a minute
         | (hammering it, and so Project Thor) and alert me once a slot
         | had opened up. Eventually provided this service to my friends
         | as well.
        
           | jotm wrote:
           | I've got something similar for appointments at citizens'
           | bureaus in some European cities. The waiting time is usually
           | around a month, which is insane imo.
           | 
           | My script constantly looks for open/canceled spots and
           | reserves them (some need email/phone confirmation, which
           | makes it a bit harder). Pretty standard stuff.
           | 
           | That's how I got my appointment in 3 days instead of a month.
           | 
           | So, I'm thinking of making money from this, but I'm not sure
           | about the legality of it all.
        
           | therein wrote:
           | I did something similar at UIUC very many years ago. I was
           | called to the office of head of Department of Computer
           | Science and kindly told while he thinks it is cool that I am
           | applying my skills relevant to my field of study, I should
           | stop what I am doing as even simply scraping could be
           | construed malicious if it got the attention of the wrong
           | people in the school.
        
         | conroydave wrote:
         | id love to get their honest opinion on the 'no hard feelings'
         | part
        
         | nunez wrote:
         | lol don't feel bad; you took advantage of a broken system and
         | automated your way through it. The first person in line
         | would've done the same if they knew how!
        
         | zhoujianfu wrote:
         | I also own the house I currently live in because of a script I
         | wrote!
         | 
         | I wrote it in 2012 to automatically buy bitcoin once a week.
        
         | dybber wrote:
         | Did the same for my previous apartment. I wrote a script
         | scraping various "self-sale" sites (sales without real estate
         | agents), the script would notify me when new apartments living
         | up to my criteria was posted online.
         | 
         | When I got such a notification I would quickly check photos of
         | the place etc. and then call the seller. The guy selling the
         | place I ended buying, said it felt like I called him up
         | instantly after he posted it online.
        
         | gcheong wrote:
         | Great story though I initially thought you meant you wrote a
         | script that paid off your house :).
        
           | hungryforcodes wrote:
           | Myself as well!
        
         | tshaddox wrote:
         | One of the things that always frustrates me (despite being very
         | much in the "first world problems" category) is when queueing
         | or reservation systems are unclear or chaotic or otherwise
         | unfair, although I generally only encounter this at stores,
         | never for something as significant as a house! The most
         | ubiquitous one is the practice of totally separate parallel
         | queues where you just have to guess which queue will be
         | fastest. Another lovely related one is when you're waiting in
         | your queue for quite some time, then a new queue opens up right
         | next to you and quickly fills up with newcomers who haven't
         | been waiting at all! Come on store owners, just have a single
         | queue with multiple consumers popping off the same queue!
         | Again, I'm not going to pretend this isn't totally a first
         | world problem!
        
           | TillE wrote:
           | Berlin's international film festival has this horrendous
           | system where they'll release a small batch of tickets online
           | every morning on certain dates, and you just have to sit
           | there, refresh refresh and hope you clicked fast enough.
           | 
           | Serious major events use a lottery system, which is vastly
           | more fair and means you don't need the server infrastructure
           | to deal with this huge flood of requests. I'm not really sure
           | why _everything_ doesn 't work like that: let people submit
           | their requests/applications/whatever, and if you truly have
           | zero other criteria, just process them in random order after
           | a cutoff.
        
           | pedantsamaritan wrote:
           | Another variation I have been on both sides of: stores
           | favoring certain channels over others. For example, a local
           | fast-food restaurant might prioritize answering the phone for
           | carry-out orders over in-person carry out orders.
        
           | jrockway wrote:
           | Something went wrong here. The price of the house should have
           | been raised until only 1 person wanted to buy it. If you're
           | first in line, the incentive is to sell it at a higher price
           | to the person who's second in line, right?
           | 
           | I have to imagine some sort of regulatory thing was going on
           | here, like they have to provide X% of units at Y% of market
           | rate in order to get some tax concession or something.
           | 
           | I know there's not going to be a lot of sympathy for higher
           | housing prices here, but it does feel like something went
           | wrong in this specific case.
        
             | rlayton2 wrote:
             | For the people selling, it is often more profitable (or at
             | least less hassle) to sell quickly with minimal fuss and
             | move onto the next one.
        
             | maxerickson wrote:
             | It's like how event tickets are routinely scalped. The
             | thing that is going wrong is that the additional bid isn't
             | worth the reputational drama.
             | 
             | Homo economicus would understand the the seller is simply
             | being efficient. Homo sapiens gets all emotional about it.
        
           | mikepurvis wrote:
           | Camping reservations for Ontario Parks are a big mess like
           | this-- so much so that people do ridiculous hacks like
           | booking the full two weeks that lead into their desired
           | weekend and later paying a fee to cancel just the first part
           | of it. By the time the actual popular weekend would have come
           | available for online booking, it was already taken weeks
           | earlier.
        
             | cecilpl2 wrote:
             | I wrote a script to poll the Parks Canada reservation
             | system for availability for a camping trip I wanted to do,
             | so that I'd get notified the instant someone cancelled and
             | space became available.
             | 
             | Sadly after two weeks they banned my IP for the rest of the
             | year and I was no longer able to make reservations without
             | going through a proxy.
        
               | polishdude20 wrote:
               | A friend and I made a website based around this called
               | campalert.live We've had to stop doing BC and National
               | Parks as the API changed and we haven't had time to
               | update our end. But Alberta still works!
        
               | sequoia wrote:
               | I'm pretty sure they do this on their own now. I set up
               | "notify me" for a site and got tons of emails as sites
               | became available.
        
             | sequoia wrote:
             | Wow, thank you for explaining this!! I was wondering how
             | weekends that were "not yet available for online booking"
             | were already nearly fully booked when I looked on the
             | booking site. Very irritating that people do this... With
             | that out of the way, I'll go ahead and start doing this
             | myself, if that's the price of admission
        
           | cgriswald wrote:
           | I definitely appreciate a single queue. It doesn't seem to be
           | the norm though.
           | 
           | If it's a place you frequent, pay close attention. The
           | checker is usually a stronger indicator of line speed than
           | the number of items in peoples' baskets.
           | 
           | Whole Foods near me does this awful thing where the lines are
           | in the aisles. You can't even see how long the line is
           | without walking the entire length of the store.
        
           | ipaddr wrote:
           | Is a jealousy issue? Without the second line you were going
           | to take as long as you were. Opening a second line helped
           | people further back catch up and in some cases surpass your
           | speed. Someone else having a quicker experience shouldn't
           | have changed your experience.
        
             | tshaddox wrote:
             | I wouldn't call it jealousy to want everyone to be served
             | in the order they arrived, since that's obviously the
             | intention of flat unprioritized queues. You can certainly
             | make arguments that FIFO _isn't_ the best or right way to
             | process a grocery store checkout queue, but for now I'd
             | rather it be implemented well rather than poorly.
        
             | stockboss wrote:
             | maybe it's more of a fairness issue. in theory, the proper
             | way should be to have a single line that funnels to any
             | available lane, so any newcomer would still have to join
             | the same line and not get any advantage over someone who
             | has been waiting.
        
         | tomcam wrote:
         | Your generosity gave you the best possible outcome in this
         | deal. Impressive.
        
         | japhyr wrote:
         | I appreciate you bringing this up, because I think this plays
         | out all the time. I live in a small isolated town, and there
         | wasn't a lot of turnover in houses even before the pandemic. I
         | wrote a short script that scrapes all the listings, and alerts
         | me to any new local listing. It was a fun little project to
         | learn about generating text messages, and to see how effective
         | a cron job on a sleeping MacBook can be. We ended up getting a
         | house through a friend who sold their home without listing it,
         | but those alerts were really helpful, and almost got us one
         | house a little earlier.
         | 
         | The bigger story here is what this means for the divide between
         | tech-literate people and the rest of the population. I don't
         | think the parent commenter was wrong to write their script, and
         | I don't think I was wrong to write mine, and if you wrote
         | something similar I think it was a reasonable move as well. But
         | we have to recognize the advantage this gives us, as people who
         | are able to spot these opportunities and act on them.
         | 
         | I don't have any answers, but I think this story brings up a
         | good discussion. I'm curious to hear other people's thoughts on
         | this.
        
           | davnn wrote:
           | > The bigger story here is what this means for the divide
           | between tech-literate people and the rest of the population.
           | 
           | Where I live the good deals from private sellers (mostly
           | older people) pretty much never get posted online, thus you
           | would have to socially integrate somehow offline in the
           | region you would like to buy a house :). It looks like I
           | still have to wait for some cultural development to benefit
           | from your proposed divide.
        
           | philsnow wrote:
           | Especially in smaller markets, there aren't very many agents.
           | You can get a lot out of inviting realtors to coffee from
           | time to time. When somebody is thinking about selling, they
           | often talk to realtors early on, so you can learn about them
           | before they hit the MLS.
        
         | adhesive_wombat wrote:
         | I did basically exactly this but for reserving a spot at the
         | visa centre for a residence permit appointment.
         | 
         | Subverting a small aspect of the Hostile Environment[1] took a
         | little bit of the edge of the general bastardry of the whole
         | process. Still a bloody expensive and emotionally draining
         | experience though: if it has to be done again, I won't be
         | putting a loved one though that again and we'll both be
         | leaving.
         | 
         | [1]
         | https://en.wikipedia.org/wiki/Home_Office_hostile_environmen...
        
         | zachwill wrote:
         | Very cool! Great story.
        
       | diatone wrote:
       | In case anyone's interested in the math to get the dice answer,
       | it's (1 + 2 + ... + 6) * 2500 / 6 = 8750. At least, I think it is
        
       | gjs278 wrote:
       | I wrote a scraper that looked through substitute teacher jobs for
       | a friend. she subbed 30 days in a row and got a full time job due
       | to it.
        
       | Semiapies wrote:
       | Some years back at work, I actually hit the size limits of email
       | rules in Outlook, just for filing emails into folders for my
       | clients. So, I wrote the first of a few iterations of an email-
       | filtering script in Python, connecting into the office's Exchange
       | server in different ways as we upgraded.
       | 
       | The current version wraps exchangelib and, besides just running
       | the straightforward Python code rules, checks whether the email
       | is in a thread and files it away in the folder with the previous
       | emails. (This is the _slow_ part over the web API, with walking
       | folders to find the location of any particular thread the first
       | time it 's encountered adding a few seconds to the run. If I find
       | myself caring about the few extra seconds, I'll try one of a few
       | ways it's occurred to me to speed it up.)
       | 
       | While at first I slightly minded having to run the script instead
       | of Outlook silently tucking them away, I found I liked the chance
       | to see what was in my inbox first.
        
       | vermarish wrote:
       | My friend invited me out to karaoke, but most of the songs I know
       | aren't popular enough to be in karaoke systems. It turns out that
       | the local karaoke place has a song database that serves queries
       | formatted as a URL parameter, so I wrote a script to query it for
       | every artist I've listened to on Last.FM. I found out that Black
       | Sabbath and Iron Maiden are surprisingly good picks for karaoke!
       | There were also a few singles I didn't expect from Children of
       | Bodom and Arch Enemy. https://github.com/vermarish/karaoke-sign-
       | in
        
       | somdax wrote:
       | I wrote a tiny program to help me buy a puppy :)
       | 
       | The place I wanted to get a puppy from said that they didn't take
       | reservations for the upcoming puppies until they were born. The
       | only way to know when they were born was to check their website
       | and then give them a call.
       | 
       | So the tiny program I wrote kept checking a webpage and whenever
       | it changed content, it would sende a text message "PUPPY ALERT!".
       | 
       | A few hours after I deployed the program, I got message so I
       | thought it had a bug, but no, the puppies had just been born <3
        
         | hereforphone wrote:
         | To those thinking about getting a dog: please consider a
         | shelter first.
        
           | frockington1 wrote:
           | I was ineligible to adopt a Daschund from a shelter because
           | my property doesn't have 1 acre of fenced in yard. Other
           | places required 2 veterinarian references (we had 1 reference
           | due to owning a cat). It can be a lot harder than people
           | think to adopt a dog from a shelter
        
             | iamricks wrote:
             | To adopt my cat during covid i had to do a Facetime
             | interview with the shelter and show them around my place.
             | 
             | It felt like i was applying for a job.
        
             | henryfjordan wrote:
             | This really varies. I got this kind of treatment from a
             | group of ladies fostering Shi Tzus. I think they really
             | just wanted an excuse to keep those dogs or give them to
             | new potential old-lady friends.
             | 
             | At the next place I tried they basically threw the dog at
             | me.
        
             | tshaddox wrote:
             | I was recently having a conversation with a married couple
             | I had just met through a mutual friend. They were detailing
             | their recent difficulties trying to get a dog. They were
             | looking at both shelters and breeders, and both had their
             | own difficulties, costs, red tape, waiting periods, etc.
             | The woman was also pregnant with their first child. I
             | asked, and the irony was not lost on them.
        
             | anthomtb wrote:
             | One acre of fenced yard for a dachshund? I've seen onerous
             | dog ownership requirements before but never that much land
             | for that small of a canine.
        
           | gcheong wrote:
           | If you're set on a particular breed also consider a rescue
           | that specializes in that breed if there is one.
        
           | munificent wrote:
           | This is very good advice, but I wish it wasn't presented
           | without qualifiers. There are good reasons to get a shelter
           | dog:
           | 
           | - You are potentially saving a dog's life that would
           | otherwise be put down.
           | 
           | - They are often initially cheaper than buying a dog from a
           | breeder.
           | 
           | People rightly focus on the strong moral argument of the
           | first point and they even emphasize the second to imply that
           | it's a good self-interested choice too. But they advocate so
           | strongly that they often omit the real downsides:
           | 
           | - The long-term cost may be higher. There are breeds that are
           | known for significant health problems, but many breeds don't
           | have them and if you buy a puppy of those breeds, their
           | health is closer to being a known quantity. With a shelter
           | dog, you are rolling the dice. There is maybe an argument
           | that hybrid vigor makes shelter mutts statistically more
           | healthy, but that has to be balanced against the facts that
           | (1) the dog may have ended up in the shelter _because_ of
           | health problems or (2) the dog 's life pre-shelter may have
           | _caused_ health problems.
           | 
           | - There may be long-term behavioral problems. Dogs in
           | shelters may have been feral, living on the streets, abused,
           | or relinquished because of behavioral problems. If they were
           | feral and weren't potty trained well as a puppy, you may
           | never train them out of marking. Even if the dog was homed,
           | the kind of people who don't spay and neuter their animals
           | (thus leading to puppies that end up in the shelter) are
           | often the kind of people who don't train them well either.
           | There also seems to be a correlation with shelter dogs coming
           | from dog fighting communities. You see a ton of pitbulls,
           | which are wonderful sweethearts when raised right but are not
           | when they aren't. Even non-pit breeds may have been abused as
           | bait dogs.
           | 
           | I love the dog I got from a breeder, and I love my shelter
           | dog (who is snoring next to me as I write this), but the
           | latter was _not_ the pure win that shelter advocates often
           | make it out to be.
           | 
           | The right way to think of it is sort of like getting a used
           | car: it _can_ save you money and be a morally good choice (in
           | the case of a car, less waste and better for the
           | environment), but it 's also an unknown quantity where you
           | need to do more due diligence to know what you're getting
           | into, or accept that you are taking a risk with higher
           | variance.
           | 
           | But, unlike with a car, you're signing up for the dog for
           | life.
           | 
           | So, yes, please consider a shelter first. Any future dogs I
           | get will likely be shelter dogs. But consider it _cautiously_
           | and take your time finding the dog that is right for you.
        
             | hereforphone wrote:
             | Wall of text on point. I got a shelter dog 5~ years ago and
             | it is a relatively difficult breed. I knew nothing about
             | dogs. But I love it and take care of it (because I take
             | ownership of my decisions, particularly where they involve
             | the life of another creature), and it's gotten better over
             | time. I also exercise caution where necessary.
             | 
             | If I had to do it again, I'd get an easier breed.
        
             | cgriswald wrote:
             | Anyone getting a shelter dog should pay for a dog
             | behaviorist to either help them select a dog or evaluate
             | the dog they have selected. They should also have a trainer
             | lined up to help them teach the dog how to live with them.
             | This goes 20x for first time dog owners.
        
             | Ntrails wrote:
             | > There may be long-term behavioral problems..
             | 
             | I know this is right - but I feel obliged to point out that
             | _this is true with a new puppy too_.
             | 
             | Training dogs properly is work, and inconsistent or
             | incomplete training only gets harder and harder to fix.
             | Plenty of dogs in shelters are there because owners could
             | not rectify their own mistakes. Not from malice, or lack of
             | caring. Simple unknowing incompetence.
             | 
             | Don't be too quick to judge those who give dogs up
        
               | hbn wrote:
               | Right, but when you don't know the dog's breed (i.e. it's
               | 17 types of cross-breeds) nor its history (if it's gonna
               | have PTSD from being abused or fighting for its life in
               | the streets), it's a much safer bet to get a purebred or
               | simple/common cross of 2 breeds where you can Google the
               | general behaviours of those types of dogs, and you know
               | its entire history of life up to that point: being born,
               | then laying around with its siblings and mom
        
               | cgriswald wrote:
               | You really want a common cross that has been breed from
               | that same cross for generations. Otherwise what you get
               | is an unpredictable grab bag of behaviors from the
               | original breeds.
        
               | munificent wrote:
               | I'm not saying this to judge the dogs' original owners.
               | In many cases, the dog was feral and there _is_ no
               | original owner.
               | 
               | The important point is that dogs go through developmental
               | milestones just like people and when you get a dog that
               | has already finished its puppyhood, you have lost the
               | opportunity to be present during those milestones and
               | train the dog. Dogs _can_ learn as adults, of course, but
               | correcting bad behaviors is a _lot_ harder. When you get
               | a younger dog (shelter or not), they are more plastic and
               | easier to train.
               | 
               | Yes, of course, it's on you to actually do that training
               | well, but at least you have the _chance_. When you buy an
               | adult dog, which is what most shelter dogs are, you 're
               | kind of stuck with what you get.
        
         | livinglist wrote:
         | I did something similar not long ago.. lol
        
         | uxcolumbo wrote:
         | For anybody considering getting a dog - please consider
         | adopting rather than buying.
         | 
         | * You're Saving A Life
         | 
         | Adopting a dog from a shelter not only means that you're giving
         | him a happy life, but you also free up a spot at the rescue or
         | shelter to save another dog's life.
         | 
         | * Helps Fight Puppy Mills
         | 
         | Approximately 90% of puppies you can buy in pet stores or
         | online are from puppy mills. Adopting a dog from a shelter
         | takes business away from mills. The more people who adopt, the
         | more puppy mills have a hard time staying in business.
         | 
         | More reasons: https://www.caninejournal.com/adopt-dont-shop/
        
           | vgel wrote:
           | Except every dog adoption place around here has requirements
           | like "Must be an experienced dog owner, have a 5 acre yard,
           | own your home, and be able to do 50 push-ups without getting
           | out of breath. Expert sword-swallowers preferred."
        
           | epolanski wrote:
           | Also, if you care about environment consider not getting an
           | animal at all.
           | 
           | The idea that we grow food to feed cattle or fish to feed
           | pets is among the biggest environmental stupidity I can think
           | of.
           | 
           | I went vegetarian to help the environment and here people
           | feeding dogs and cats fish and meat. Makes me think we're
           | doomed for extinction.
        
         | lgvld wrote:
         | Such a cute story :)
        
       | merely-unlikely wrote:
       | I wrote a script to email me the top 10 Hacker News articles at
       | lunchtime. And now I'm here :)
        
       | jbmny wrote:
       | > one of my favourite things is to use secret undocumented APIs
       | where you need to copy your cookies out of the browser to get
       | access to them
       | 
       | I love this too. It's always a nice surprise when you realize you
       | won't be needing to write xpath/pyquery/et al. after all... It's
       | like the scraping has already been done for you!
        
       | kinduff wrote:
       | What a nice read. Motivates me to make a list of these small apps
       | I have all over the place; Raspberry Pis, DO servers, Netlify,
       | etc.
       | 
       | It also reminds me about that usenet story where in a company
       | their lead developer left, and they discovered some fun scripts
       | to automate excuses for his wife, or turning on the coffee
       | machine through telnet. Can't remember the name.
        
         | nso95 wrote:
         | https://github.com/narkoz/hacker-scripts
        
       | johnklos wrote:
       | Tiny projects like these are fun and rewarding. I just wish I
       | were as good as Julia at keeping track of them. After reading
       | this, I think I'll start keeping track of them in one place :)
        
       | 333c wrote:
       | I also wrote a script to get a vaccine appointment! I wonder how
       | many other people did that.
        
       | alexpovel wrote:
       | A couple years ago, I switched from German QWERTZ to a UK QWERTY
       | keyboard (wouldn't have minded US QWERTY but the differently
       | shaped return key seemed too foreign). I am not looking back: for
       | programming but also general tasks, having keys like
       | ` [ ] \ / { }
       | 
       | very easily available is a blessing. The German QWERTZ keyboard
       | has _triple_ occupation on some keys, which is not ergonomic and
       | harder to type fast with.
       | 
       | Anyway, both Linux and Windows offer fast switching between
       | installed keyboard layouts/languages using SUPER+SPACE. This is
       | needed in e.g. emails, where I still need Umlauts. It's just much
       | easier to read that way. However, switching back and forth
       | constantly is completely overwhelming and not viable. However, in
       | German, there are perfectly and officially (?) acceptable
       | alternative spellings for our special "Unicode"-characters. They
       | can be typed using plain ASCII, aka a QWERTY keyboard.
       | 
       | So, I wrote a script to read in any text, combined it with
       | AutoHotkey on Windows and now have a tool that, at the touch of a
       | button, replaces selected text using alternative spellings
       | (gruen, Duebel, Faehre) with their correct versions (grun, Dubel,
       | Fahre). The tool could be extended for other languages rather
       | easily. I've been using it for over a year now and recently got
       | to release it properly on the cheese shop:                   pip
       | install betterletter
       | 
       | (https://pypi.org/project/betterletter/)
       | 
       | Before putting this together, I had looked around for an existing
       | tool. To my surprise (there's always something!), I found
       | nothing. I guess this scratches a too specific itch: using QWERTY
       | but wanting proper spelling quickly, while remaining on QWERTY as
       | to not have a mental breakdown and stay at full typing speed.
       | 
       | After writing, select everything (CTRL+SHIFT+HOME works well),
       | hit shortcut, text will be replaced. This takes about 2 seconds,
       | much faster than switching keyboard layouts back and forth. If
       | this ran as a daemon with the dictionary loaded into RAM already,
       | the script could run almost instantaneously (most of the 2
       | seconds is IO, reading from disk), in linear time according to
       | the text input size.
        
         | w-m wrote:
         | Neat! I'm using QWERTY International layouts myself, where you
         | can type umlauts and ss with special keys for modifiers (e.g.
         | alt+u on Mac for "), but I still think this is a cool tool.
         | 
         | Looking through the repo I wondered why you would commit the
         | complete German dictionary weighing in at over 30 MB, whereas
         | you only need a small fraction, the words containing the
         | umlauts (or their false matches). Surely this would be a huge
         | performance boost?
         | 
         | Turns out: a whopping 30% of that dictionary are words
         | containing "ae|oe|ue|ss|a|o|u|ss". Crazy. I would not have
         | guessed that, at all.
        
           | alexpovel wrote:
           | > Neat! I'm using QWERTY International layouts myself, where
           | you can type umlauts and ss with special keys for modifiers
           | (e.g. alt+u on Mac for "), but I still think this is a cool
           | tool.
           | 
           | Yeah, I had looked into these but for some reason that didn't
           | work. Don't remember why.
           | 
           | > Looking through the repo I wondered why you would commit
           | the complete German dictionary weighing in at over 30 MB,
           | whereas you only need a small fraction, the words containing
           | the umlauts (or their false matches). Surely this would be a
           | huge performance boost?
           | 
           | Yes! It would be performance boost. In fact, I had a
           | "caching" sort of functionality in the tool before. The whole
           | dictionary is shipped (because that makes it much easier and
           | there's almost no risk of wrong-doing just copy-pasting a
           | word list, plus it compresses well enough), but then a list
           | containing only special characters will be generated on first
           | use if it doesn't exist yet.
           | 
           | As you noted, a lot of words do contain special letters, so
           | the "complexity" wasn't worth it to me and I removed that.
           | Could be brought back anytime, but it's fine for now.
        
         | tedunangst wrote:
         | Just fyi, Windows will let you set a keyboard layout per
         | window. If you like writing programs, you can write one to
         | switch the linux keyboard layout based on active window.
        
       | bArray wrote:
       | > When the second COVID vaccine doses opened up, all of the slots
       | were full. It turned out that the website's backend had an API,
       | so I wrote a script to poll the API every 60 seconds or so and
       | watch for cancellations and notify me so that I could get an
       | earlier appointment.
       | 
       | I imagine the hacked together COVID vaccination websites were
       | already under quite a high load. If it's anything like
       | unoptimized WordPress websites it's doing a database query each
       | time and I really hope the API wasn't being shared by healthcare
       | providers. The saving grace appears to be that the script isn't
       | shared.
       | 
       | I guess this is a reminder to be careful when sharing scripts
       | that rely on other's services (especially important services).
       | Cache when possible, poll minimally, etc. Recently I found out
       | that Ubuntu doesn't cache DNS queries by default, which I
       | discovered when I got temporarily blocked from a DNS server. Good
       | job I didn't share that script!
        
       | eindiran wrote:
       | My recent favorite small program I wrote:
       | 
       | Was watching a movie with a group of friends which someone had
       | ... acquired from the internet, but it didn't have any subtitles.
       | Someone found an SRT file, but the subtitles were offset by quite
       | a bit - enough that you would be seeing dialogue in the subtitles
       | for what had been onscreen 10+ seconds ago, which kind of
       | defeated the point of getting the subtitles. So I wrote a program
       | in a few minutes to specify an offset and rewrite all of the
       | timestamps in the file. We timed the offset, ran the script and
       | got to watch the movie with working subtitles less than 20
       | minutes later.
        
         | Dyac wrote:
         | VLC allows you to specify a subtitle offset, fyi.
        
         | adhesive_wombat wrote:
         | FYI, Aegisub can do that.
         | 
         | It used to be a regular thing for me since I already have
         | subtitles on (ESL spouse). The worst is when you have a time
         | shift _and_ a different frame rate, as it 'll slowly get worse
         | over time, but seem ok for the first few minutes.
         | 
         | Recently, Plex's "agents" seem to be good enough at figuring it
         | out and auto-downloading subtitles that it's not often a
         | problem.
        
       | sideproject wrote:
       | I frequent ProductHunt to see what new products are launched. I
       | usually click on every link. That takes time and hurts my fingers
       | clicking. So I automated it and created an app called Rockmelon.
       | 
       | https://www.rockmelon.app
       | 
       | It became a tool that opens multiple links all at once. Once I
       | had the basic foundation, I created a daily ProductHunt link,
       | which opens all the links at once. You can subscribe to daily
       | product hunt links here.
       | 
       | https://www.rockmelon.app/rc/Cg08Y06Vu9#/
       | 
       | Now my fingers are happy. Hopefully yours too.
       | 
       | You can create your own mega link with API as well.
        
       | fsniper wrote:
       | I have had many small scripts or software doing automation for
       | me. One of them is the one that found me a motorcycle. It was a
       | neat web console JavaScript code, which would go over the
       | listings and score them with a pretty basic algorithm. I scored a
       | good Cbr250 with that. In turn I dislocated my shoulder in the
       | upcoming days :) I rode the bike for a few years. It was also my
       | first and the last motorbike. Fun times.
        
       | ocdtrekkie wrote:
       | I run a badly written monolith (my home automation system), and
       | tend to make tiny personal programs some weird offshoot growth of
       | it.
       | 
       | There's upsides and downsides to this. I'm aware it's basically
       | guaranteed to be useless to anyone else because it's depending on
       | software I'd never encourage someone else to run, for instance,
       | and it locks me into certain coding choices.
       | 
       | However, I spend a lot less time doing boilerplate/framework
       | stuff, because I've already got the basics running for other
       | tasks: Stuff for logging, settings, data storage, and remote
       | control and monitoring is already a given.
        
       | [deleted]
        
       | twic wrote:
       | I wrote a little web app (Python and CGI) to organise a secret
       | santa ring. You put in a load of names with email addresses, then
       | it shuffles them, and sends an email to each person telling them
       | to buy a present for the next person on the list (wrapping
       | round). It meant a group of friends could do a secret santa
       | without one person having to know who was buying for who.
       | 
       | There's a way to put people in groups where they shouldn't buy
       | presents for each other, which is useful for couples of families,
       | where they will probably be buying presents for each other
       | anyway.
        
       | brink wrote:
       | Nice article! Here are a couple of my recent personal projects..
       | 
       | I couldn't find a command line media player that was simple
       | enough for my liking. So I wrote one for myself that uses
       | gstreamer as the back-end. https://github.com/codabrink/aquinas/
       | It's hasty code. I plan to improve it in the future by adding
       | features and switching the music library structure from an array
       | to an iterator when I find time.
       | 
       | I also needed a daemon that would watch a folder for new files
       | and upload them to Backblaze B2.
       | https://github.com/codabrink/backblaze-upload/ I use this with
       | Nginx on my vps to proxy requests to the bucket for nice looking
       | vanity urls. (http://i.kota.is/5ruvD.png) The code is really bad;
       | the focus was to build it in under 90 minutes or so, but the
       | important thing is it works, so therefore I'm not going to spend
       | anymore time on this one.
        
         | jchook wrote:
         | For a command like media player, did you try cmus?
        
           | brink wrote:
           | Yeah, I didn't like it. :)
        
       | jim_lawless wrote:
       | I wrote a command-line MP3 player in C for Windows. I just wanted
       | to play with the media manger API's, but I've ended up using this
       | to play MP3's in succession via a script.
       | 
       | https://github.com/jimlawless/cmdmp3
       | 
       | It doesn't work on all versions of Windows ... it depends on some
       | configuration elements. This has been used in another developer's
       | video game and I believe it's installed with an MP3 player
       | library in node.js ( if you're running node.js under Windows. )
       | It also plays WAV files on Windows 10 (possibly 11) if you pass
       | the name of a WAV file into the command-line.
       | 
       | I needed a command-line emailer that would send an email via
       | Gmail with a very simple one-line body for my Mac. I also wanted
       | to exercise Go's SMTP libraries while experimenting with trying
       | to build a minimal emailer application.
       | 
       | https://github.com/jimlawless/gsend
       | 
       | I use this regularly. I used to use it on MacOS, but I use it
       | more frequently on Windows.
        
       | submeta wrote:
       | I got an appointment at the registry office for my marriage
       | because of a script I wrote.
       | 
       | Years ago I desperately tried to get an appointment for a
       | marriage at my local registry office but as soon as their website
       | listet possible appointments they were gone. So I wrote a web
       | scraper that blocked an appointment as soon as it was offered,
       | and sent me an sms (via Twilio) notifying me. My script was so
       | eager that within an hour it blocked several appointments. I got
       | a call from that office wondering how often I wanted to get
       | married. So finally I got my appointment. Otherwise it was close
       | to impossible to manually book an appointment.
        
       | kevincox wrote:
       | One fun one is I was playing a game with friends and it felt
       | super random to me. So I wrote a simulator and some simple
       | strategies to see how effective these strategies were vs
       | randomness. If the game is mostly strategy you would expect to
       | see clear difference in all of the strategies. If the game is
       | mostly random the good strategies would have a hard time
       | differentiating them from each other consistently.
       | 
       | https://gitlab.com/kevincox/red7-sim
        
       | recentrecruit wrote:
       | Wrote a TI-83 program (TI Basic) for a geometry course in high
       | school. About a month prior to the feared final exam, I combed
       | through all of our coursework to catalogue all of the
       | calculations needed then wrote a program that would solve for any
       | query (length of side, angles, etc.) based on the shape and input
       | data.
       | 
       | I read the operators guide to the device cover-to-cover and found
       | a way to store the program such that the teacher's method of
       | "clearing" the device would not remove my program.
       | 
       | On the day of the test I realized I had accidentally taught
       | myself geometry, as I didn't need the calculator at all and could
       | do the calculations in my head. I did, however, use the TI-83 to
       | verify my answers before handing in the test. According to my
       | teacher I not only had a perfect score but did so in record time,
       | and suspiciously so did my two best friends.
       | 
       | Nothing ever came of it, but I enjoy the fact that I accidentally
       | learned a course to such proficiency by trying to cheat.
        
         | Sohcahtoa82 wrote:
         | While in my Algebra II class, we were studying polynomial
         | expansion, and I wrote a program on my TI-85 that would not
         | only expand things like (2x^2 + x + 3)^4, but it would _show
         | the work_. I literally just had to enter a couple values and
         | then verbatim copy what it spit out onto the paper.
         | 
         | I asked the teacher if I could use it on the test, and she was
         | like "If you can write a program that doesn't just solve it,
         | but shows the work, then obviously you know the material
         | incredibly well, so there's no need to make the test tedious.
         | Go for it, just don't share the program with any of your
         | friend."
         | 
         | The last bit was easy because I didn't have any friends. :-(
        
         | twodave wrote:
         | I actually got into programming on my graphing calculator in
         | high school in the early 2000s. Most of our tests from algebra
         | up thru calculus were simply "apply the correct formula to the
         | problem". I would simply program the calculator with the
         | formulas, use it to calculate the answers and then work
         | backwards to "show my work". I got 100% on every test for 4
         | years. I'm still not sure whether I feel guilty or not.
        
         | Semiapies wrote:
         | You might find it funny that a scaled-up version of this was
         | the plot of a 1958 children's book, _Danny Dunn and the
         | Homework Machine_. (Except the teacher figures it out and
         | starts assigning the kids using the computer more advanced work
         | that they have program the computer to perform.)
         | 
         | https://en.wikipedia.org/wiki/Danny_Dunn_and_the_Homework_Ma...
        
       | lhuser123 wrote:
       | I write tiny programs with pyautogui to automate parts of my job.
       | It's like having an assistant.
        
       | wolfgang000 wrote:
       | I did something similar to the vaccine appointment bot but to get
       | my passport appointment, I'm Venezuelan, and let me tell you
       | getting a passport is almost impossible due to all the corruption
       | and mismanagement, so years ago the webpage to schedule the
       | passport appointment was down for 99.9% of the times, I am not
       | joking the page was only functional for a 10~15 minutes per week
       | at random intervals of the day, there were facebooks groups of
       | people doing watch reloading the page every few minutes ALL DAY
       | LONG to catch it when it was working and then inform the rest
       | when it was up, It was insane I decided to do a simple(not really
       | tho) bot that did the polling and fill my data to the form, I was
       | very happy to result and event more because I didn't have to
       | bribe anyone(This is the "normal" method to get the passport and
       | the sky is the limit of how much are they going to charge you)
       | 
       | here is the code if someone is curious about it
       | https://gitlab.com/wolfgang000/saime-bot/
        
       | conroydave wrote:
       | I'd like to add that OP has some incredible easy to understand
       | "zines" that help explain technical topics like http, dns,
       | containers etc.
        
       | hegzploit wrote:
       | These little quality of life scripts are life savers, I've made a
       | script which I'm really proud of and still use to this day, in my
       | university they usually release assignments every now and then
       | and I had to check each course's page manually for any new
       | deadline, so I made a python script that scraped the website and
       | would print any new assignments since the last run of the script.
       | I would later make a little telegram integration where new
       | assignments were sent on a group chat for my class mates to get
       | notified too and left the script running in crontab on some vps I
       | had around. https://github.com/hegzploit/lazy-chicken
        
       | pseudosavant wrote:
       | I love to put simple web apps like this on Glitch.com.
       | 
       | Days Until - Create a URL to countdown to any date:
       | https://glitch.com/edit/#!/days-until
       | 
       | Flexible Fetcher - scrape/fetch contents of a page based on HTTP
       | query params: https://glitch.com/edit/#!/flexible-fetcher
       | 
       | Scrape HTML <table> return JSON: https://query-page-table-to-
       | json.glitch.me/?url=https%3A%2F%...
       | 
       | USPS Zipcode Lookup + offline JSON - easily add city,state
       | autocomplete from zipcode: https://glitch.com/edit/#!/usps-
       | zipcodes-demo
       | 
       | Create Data URIs - 100% client side:
       | https://glitch.com/edit/#!/data-uri-pwa
       | 
       | Frame Counter - great for testing latency across displays or
       | remote links (e.g. Parsec) using a camera:
       | https://glitch.com/edit/#!/frame-count
       | 
       | NBA Team Standings in JSON: https://glitch.com/edit/#!/nba-
       | standings
       | 
       | Read/render markdown files on your HTTP server:
       | https://glitch.com/edit/#!/markdown-html-remix
       | 
       | Create map links that open in Apple Maps on iOS and Google Maps
       | everywhere else: https://glitch.com/edit/#!/apple-maps-link
       | 
       | Clean your Amazon URLs: https://glitch.com/edit/#!/clean-amazon-
       | url
        
         | ciroduran wrote:
         | I love Glitch, I wrote a number of Twitter bots. But then they
         | changed some things in the free tier (understandably), so I
         | moved my bots to a local server that runs Docker, with each
         | container running a bot, and I'm really happy it's chugging
         | along.
        
           | pseudosavant wrote:
           | I'm dying for Glitch to get native Deno support.
        
       | belkarx wrote:
       | When I was first learning to code, I spent a few hours writing a
       | python script to get Advent of Code files and prompts, then open
       | them in an editor, and also eventually made a util to check the
       | answers. Fun times.
        
       | prometheus76 wrote:
       | I haven't turned it into a standalone program yet, but I wanted a
       | way to calculate praying the Orthodox Book of Hours according to
       | a sundial instead of a normal clock, and I used excel to do it.
       | 
       | I found the formula for determining sunrise and sunset using
       | latitude and longitude from NOAA's website. This allowed me to
       | generate a sunrise/sunset table for my location by day.
       | 
       | I use VBA to update a clock every 10 seconds (I didn't need it to
       | be more accurate than that) that feeds to a cell, and I use that
       | to know when it is time for First Hour (sunrise), Third Hour (9
       | am, or 25% of the day), Sixth Hour (50% of the day), and Ninth
       | Hour (75% of the day).
       | 
       | I have it all working and it runs in Excel on my work computer.
       | My goal is to translate the logic into an app on my phone so that
       | I can get notifications when it's time to pray. It's been a fun
       | project, which included a side project of making a 9-LED display
       | in Excel for the clock. I have a clock for normal world time, and
       | a clock for sundial time.
       | 
       | It's been a fun project!
        
         | rauhl wrote:
         | Heh, I did that with Emacs! It already has sunrise & sunset, so
         | the rest of the math was easy.
         | 
         | Excel & Emacs: two things starting with E which let anybody
         | program anything.
        
       | friggeri wrote:
       | These resonate a lot! Tiny projects are very rewarding, because
       | you get something that works pretty quickly, this works well with
       | my short attention span. Couple of ones I did in the last two
       | weeks:
       | 
       | - A little mac app that reads my calendar, grabs the next 2-4
       | events and sends them over to my Vestaboard.
       | 
       | - Setting up Cloudflare as a failover load balancer to reach my
       | home network (I have two ISPs for redundancy), this involved
       | writing a small script to get the WAN IPs out of my Omada router
       | and using that as a custom command in ddclient to update the DNS
       | entries for both uplinks.
        
       | jsdwarf wrote:
       | Created a python script that scrapes the holding lists for each
       | of my ETFs and outputs an aggregated list of all companies I am
       | invested in through the ETFs. Can also compute how similar two
       | ETFs are based on their holdings. Has saved me some order fees
       | because it drastically reduced the ETFs I am investing in.
        
       | LinasKo wrote:
       | A lot of the music I like is on YouTube, including many obscure
       | remixes and covers. Now, I'm not a fan of forgetting things and
       | YouTube can be pretty volatile, with videos getting removed.
       | 
       | Rather than downloading all the audio, I made a playlist scraper
       | for the names. Runs once a day on PythonAnywhwre, collects the
       | names into a database, helps me sleep at night.
        
       | ggerganov wrote:
       | I've always wondered what would be the chance to win the lottery
       | if I played consistently a certain set of numbers. Every day, no
       | excuses.
       | 
       | So I wrote a script to scrape the lottery site archive and check
       | retrospectively the success rate [0]. Well.. the result is what
       | you would have expected.
       | 
       | [0] https://ggerganov.github.io/lottery-check
       | 
       | Bonus - clicking the "Random" button helps you really understand
       | how futile playing the lottery actually is.
        
       | 75central wrote:
       | When I briefly returned to the Windows world, I wrote a quick-
       | and-dirty application that would clean the shortcut links that
       | installs would clutter my desktop with.
       | https://github.com/MattGHarvey/ShortcutCleaner
        
       | eddieroger wrote:
       | The stories on this page, as well as the other comments here,
       | make me really happy because they're all examples of computers
       | making life better, as opposed to being passive consumption
       | devices. Pretty often, I think back to putting together a
       | database to track invites to my bar mitzvah on a 386 running a
       | program called MyDataBase - it created print jobs for envelopes,
       | let me mark back RSVPs, track gifts and thank you notes,
       | everything. We carry such powerful computers in our pockets these
       | days, but there are so few apps that I know of that actually use
       | the device to make our lives easier. I wish more people knew how
       | to use these tools the way the audience here does, or that I knew
       | enough to make something that others could then use to do the
       | same.
        
         | nunez wrote:
         | So many people think that the most recent generations are more
         | computer-savvy because they use computers and smartphones all
         | of the time. Quite the opposite; many are app-savvy, not
         | computer-savvy. While I've gotta hand it to the amazing PMs, UX
         | researchers, designers, and SWEs that have contributed to this
         | phenomenon, it's a shame that computer literacy in general is
         | so poor on average.
        
         | mooreds wrote:
         | > The stories on this page, as well as the other comments here,
         | make me really happy because they're all examples of computers
         | making life better,
         | 
         | Hear hear! I love stories where computers help relieve human
         | misery.
         | 
         | I got into programming because my parents had a business that
         | required them to mail their clients a legally required notice
         | every year. They originally were copying the letter, changing
         | the address and a few other pieces of data, and then printing
         | it out and mailing it.
         | 
         | While I couldn't help with the latter, the former seemed like a
         | great job for a database and mail merge. I set up WordPerfect
         | to mail merge, and got started entering data (one month's
         | clients at a time). Whenever the day to send out the mail came,
         | it was a simple matter to merge in the data, generate a long
         | WordPerfect doc, and print it out. Once the first year went by,
         | it got even quicker. I ended up porting the dataset a couple of
         | times to more advanced databases (eventually PostgreSQL).
         | 
         | The first time they saw how easy it was going to make this
         | onerous task, they were pretty happy.
         | 
         | And I was hooked on software as a way to lessen such tedium.
         | 
         | Edit: Of course now, I'd use a tool like lob to actually send
         | the mail too.
        
       | throwthere wrote:
       | That Covid vaccine project gives me chills. That's not saying
       | it's wrong to use an advantage like coding skill or anything else
       | to increase your odds of surviving a pandemic-- but it's a new
       | world we live in for sure.
       | 
       | Edit: I guess I need to clarify I'm not asserting anything was
       | right or wrong.
        
         | kinduff wrote:
         | Have done the same but using a scrapper, not for COVID, but for
         | an impossible to schedule appointment I had to do in a
         | government website.
         | 
         | I still think it could be monetized but I don't feel like doing
         | it. I heard a friend that there is a lot of people doing this
         | manually and they charge you a considerable rate.
        
         | mr_mitm wrote:
         | This was done with a lot of collaborative effort in Germany:
         | 
         | https://github.com/iamnotturner/vaccipy
        
         | Macuyiko wrote:
         | We had a similar governmentally organized system in our country
         | during the first vaccination round where people could book an
         | appointment. The website fell over and the devs introduced a
         | queuing system and had you waiting in line. Except that it was
         | badly implemented and only enforced client-side (through
         | JavaScript) and hence very easy to circumpass. It also had a
         | similar API which could be polled to see when a slot freed up.
         | 
         | This actually happens quite often. As another example, there is
         | a particular country visa centre which requires you to make an
         | appointment and is typically fully booked for weeks on end. The
         | calendar info is loaded in through an API call and the selected
         | date then form POSTed with a hidden field's value set to an
         | identifier representing the date and time. Not in plaintext,
         | but easy enough so that it can be guessed. Once you spoof the
         | value, no further server-side validation happens and no one at
         | the centre will check it.
         | 
         | I wanted to book a restaurant a couple of weeks ago. As I was
         | discussing options with a friend, the booking provider already
         | forced a refresh and our desired time slot was gone. Again,
         | taking a look in the Network tab of the browser and spoofing a
         | value led to a confirmation at the desired time. I expected a
         | call saying that they were overbooked, though strangely enough
         | the place was not packed (I guess they kept some tables open
         | for social distancing / walk-ins / phone reservations).
         | 
         | This is really security 101 on the same level as SQL injection.
         | Strange how every dev seems to know how to hook up something to
         | an API but still makes the same mistakes.
        
         | bhaak wrote:
         | It's always been this way.
         | 
         | But advantages aren't always that obvious. In my case, it was
         | just "don't reload the page while waiting for the server to
         | respond" as the servers were DDOSed on the first day they
         | opened the appointments. Obvious to many programmers, not so
         | obvious to the general public that you might lose your position
         | in the queue if you reload the page and not wait for a proper
         | error page before reloading.
         | 
         | Another advantage was getting my PS5. I wrote a simple web
         | scraper that just looked if the shops had any PS5 in stock and
         | wrote that into a static RSS I uploaded to my webserver and
         | stuck this into my regular RSS reader.
         | 
         | Over the last year, this way I could provide myself and 3
         | friends/acquaintances the opportunity to get a PS5.
         | 
         | Other people can build tables and shelves. I'm a programmer.
        
         | sergiomattei wrote:
         | I did the same.
         | 
         | When vaccinations opened up for the elderly, I wrote a script
         | to check open slots and get my grandparents a vaccine
         | appointment.
         | 
         | They patched it up, but similar to the author, I managed to get
         | them one soon after through their website. I'm wondering if
         | we're even talking about the same website.
         | 
         | Wild days.
        
         | melling wrote:
         | "This didn't turn out to be necessary (more appointments opened
         | up pretty soon anyway), but it was fun."
        
       | TrapLord_Rhodo wrote:
       | I used to play a game called runescape and there was this client
       | called OS Buddy that had data dump of all 'buy' and 'sell' orders
       | in the grand exchange.
       | 
       | put the data in python and I calculated the "flip" ratio, average
       | and liquidity of the items.
       | 
       | Now that was all profitable, but around this time there was a
       | phase where everyone discovered that you could do pump and dumps
       | and make obscene profits. They worked exactly how normal pump and
       | dumps work, a select few insiders buy a bunch of the random item
       | and then after a few days they annouce it to the clan and start
       | selling their item. I could see a surge in abnormal buys for
       | items with low liqidity and effectively have a birds eye view of
       | all the pump and dumps before they aree 'Public".
       | 
       | I never had to have a job through high school as i could sell the
       | GP and make around $50-60 a day!
        
         | vorvac wrote:
         | Back when you could create accounts with usernames instead of
         | emails, I wrote a c# program that would generate a random
         | user/password/DOB, go through the three web forms, and create
         | an account. I integrated this with TOR so that on every third
         | account, I'd switch IPs to prevent throttling. I'd let the
         | thing run almost constantly and ended up with thousands of
         | accounts.
         | 
         | I sold these account lists to botters who would then go on to
         | to their thing. Made a decent amount of money from this too!
        
           | TrapLord_Rhodo wrote:
           | it'd be interesting to make a mmorpg game that was entirely
           | based on building bots. an MMORPG Programming idle.
        
             | thequux wrote:
             | Have you seen screeps? (https://screeps.com/)
        
       | beamatronic wrote:
       | >> secret undocumented APIs
       | 
       | There's precedent in the US for going to jail for doing this
        
       | anthomtb wrote:
       | My SO is not always reliable when it comes to handling home
       | duties while I'm away for work. So I setup a little Python script
       | to send a text message with a TODO list every day. Twilio handles
       | SMS, reminders are store in sqlite3, and cron runs the script
       | once a day. It lives on a DreamCompute instance so (hopefully) no
       | worries of a local power outage eliminating crucial (ok, not
       | really that crucial) reminders.
       | 
       | Are there better ways to do this? Undoubtedly. But I sure had a
       | good time making it work.
        
       | svilen_dobrev wrote:
       | if anyone finds any of these useful...
       | 
       | https://github.com/svilendobrev/svd_bin (terminal + sh setup ,
       | version-control, lots of commands for this or that)
       | 
       | https://github.com/svilendobrev/svd_util (python stuff)
        
       | creeble wrote:
       | If anyone is interested in a little script that grabs an image
       | from a webcam pointed at a 7-segment LED display and returns the
       | numbers it finds, let me know.
       | 
       | It uses the ironically-named "Let's Go Digital" training set for
       | the Tesseract OCR program. It works somewhat poorly, but good
       | enough to read my hydronic-heat boiler's display to let me know
       | that it didn't fire up in the middle of the night, so that I can
       | get up and clean the flame probe.
        
       | Zhyl wrote:
       | I feel like 'tiny personal programs' is one of the bigger reasons
       | to teach 'everyone' to code.
       | 
       | Everyone has something in their life that is very specific to
       | them that they would be much happier if it were 'just so'.
       | Writing tiny scripts or being able to dive into the
       | config/settings of something is a good way to get rid of some
       | pain points.
        
         | DrBoring wrote:
         | > teach 'everyone' to code.
         | 
         | I wonder if coding classes will be the new "shop class" .
         | https://www.lexico.com/en/definition/shop_class
         | 
         | In 8th grade, I took a compulsory wood working class. I guess
         | it was a skill that adults thought children should learn.
         | 
         | By that point, I had already been coding for 6 years. My school
         | had a computer lab, but no coding was taught .... just typing.
         | Also we played networked Oregon Trail Deluxe once or twice.
        
           | prometheus76 wrote:
           | I wish more of the engineers I work with had taken a wood
           | shop class, so that they would learn about things like kerf,
           | working with things that are out of square, tolerances, and
           | how certain milling or lathing operations are impossible.
           | Most of the young engineers I work with only know about
           | drawing things and running simulations on them, rather than
           | how things are actually built.
        
             | lasfter wrote:
             | I took a wood shop class in high school and did not learn
             | any of those things, I learned how to make spoons, boxes,
             | and cabinets.
        
               | prometheus76 wrote:
               | Fair point. But even learning how to measure things, mark
               | them, cut them out, and how to assemble things would help
               | my young engineer coworkers.
        
         | iak8god wrote:
         | For this reason, I often recommend 'Automate the Boring Stuff
         | with Python' (https://automatetheboringstuff.com/) to
         | beginners. It hits the basics and then moves pretty quickly to
         | address: OK, what can _I_ actually use this for?
        
           | v0x wrote:
           | I am not a programmer, but it has been fun learning little
           | bits of Python and making scripts to automate tasks.
           | 
           | We have folders for clients at work and everything older than
           | a couple of years should be archived, aside from certain
           | legal documents. Building a script to check if any file is
           | older than a certain date and checking that it does not
           | contain certain words in the filename, was really easy, and
           | useful, and gave me a good feeling of satisfaction seeing it
           | actually work.
        
         | syshum wrote:
         | I think we need to teach people the basics of computer
         | operations before learnToCode...
         | 
         | Computer Illiteracy is still very high, even today lots of
         | people can not tell the difference between their computer
         | monitor, and their computer.
        
           | Minor49er wrote:
           | Apparently Gen Z has trouble even understanding filesystems
           | 
           | https://futurism.com/the-byte/gen-z-kids-file-systems
        
         | jxramos wrote:
         | This right here. So often general purpose software winds up
         | being some feature anemic app that focuses on some common
         | denominator functionality. Plugin and extension support has
         | been great to expand capabilities in general to make said
         | software less confining.
        
       | coreyp_1 wrote:
       | I wrote a program to distribute my lecture slides to my students
       | in real time.
       | 
       | When I was a University Professor, I taught Theory of Computing
       | (among other classes). I did not want to maintain two sets of
       | slides (fill-in-the-blank style), and I didn't want the students
       | to have to write non-stop during the lecture, so I wrote a couple
       | of programs to distribute the slides in real time during the
       | lecture.
       | 
       | Part 1: C++. A program ran on my computer. When I pressed a
       | button, it took a screen shot of my chosen monitor and sent it to
       | my server. Communication via websockets.
       | 
       | Part 2: Browser. Students connected to my server at the start of
       | class. As I lectured, the slides appeared in their browser
       | automatically. Of course, they could click through all previous
       | slides (for that day as well as previous lectures), but if they
       | were not actively browsing the slides, then the newest slide
       | presented itself to them automatically. (Technically, it was
       | always one slide behind, because I would not release a slide
       | until I was done talking about it.) Communication via websockets.
       | It worked in lectures attended by 100+ students.
       | 
       | Part 3: NodeJS. My server received screenshots from me (as well
       | as some metadata), kept a small database of all past
       | lectures/screenshots, and served a browsable interface to the
       | students. It routed all the websocket connections so that
       | everything "just worked"TM.
       | 
       | I thought it was cool. The students complained that the slides
       | were not searchable like a PDF. I directed them to the index of
       | the textbook.
        
       | derekp7 wrote:
       | One I did when I was much younger was after a trip to a Cracker
       | Barrel restaurant. They have these golf tee peg games (triangle
       | shaped board with holes and golf tees inserted). There are rules
       | for doing jumps and removing pegs, with the goal of getting down
       | to 1 peg remaining.
       | 
       | So I went home, fired up basica on my PCjr, and wrote a brute-
       | force solver for it. Turns out there something like tens of
       | thousands of possible solutions.
       | 
       | Then it became a challenge, to filter out duplicates (each
       | solution appears 3 times if you apply it to the board with each
       | 120 degree rotation, plus you have mirrors of these, etc). Was an
       | amazing feeling for a youngster getting into computers.
        
         | spc476 wrote:
         | I did the same thing (only under Linux, not MS-DOS). I also
         | found out that leaving 8 pegs is _way_ harder than just 1 peg
         | (2 ways, excluding reflections and rotations). And for 10 pegs,
         | only 1 way.
         | 
         | Edit: Update number of ways to leave 8 pegs, and added number
         | of ways to leave 10 pegs left.
        
         | ectopod wrote:
         | https://en.wikipedia.org/wiki/Peg_solitaire
        
       | tomcam wrote:
       | Mad props. I never managed to finish a one night project in one
       | night.
        
       | jrockway wrote:
       | I thought about writing a program to get myself a vaccine
       | appointment, but ultimately decided that we probably didn't want
       | to vaccinate people in order of software engineering ability. I
       | don't have to physically go to work, and can afford to have
       | groceries dropped off in front of my apartment, so there was
       | really no reason I should get the vaccine before everyone else. I
       | can just self-quarantine with zero inconvenience or consequence,
       | so probably a better use of limited resources to give it to
       | someone else first.
       | 
       | But at the same time, I also feel like literally nobody is
       | looking out for you personally in the pandemic. I got the
       | impression that pharmacies flat out lied to the government about
       | vaccine availability (city websites would be like "oh yeah your
       | CVS has tons of extra capacity" but then they have no
       | appointments, and when you do get an appointment and show up,
       | they turn you away). In that case, you have no choice but to DoS
       | them to meet your basic medical needs. (Insert rant about how I
       | was first able to buy N95 masks and at-home COVID tests in
       | January 2022, 2 years after the first case. Now I have them for
       | next time, I guess.)
        
       | shimonabi wrote:
       | I had a relly nice free seaside summer vacation because of a
       | Python script.
       | 
       | In our country we got vouchers to take a holiday because of
       | Covid, but I couldn't use Booking.com because not all landlords
       | had the proper paperwork to be able to redeem the voucher.
       | 
       | I wrote a script to e-mail all the properly registered landlords
       | from a government list in a particular region with my
       | requirements and then manually selected the best offer. I had a
       | really good time.
        
       | guruparan18 wrote:
       | Interesting to read the "dice rolling" part.
       | 
       | > investigating dice rolling patterns A friend showed me a dice
       | rolling game where you roll a bunch of dice and add up the
       | values. I mentioned that if you roll enough dice and add up all
       | the values, at some point it gets a lot less "random".
       | 
       | And result turned out "true"? Rolled a die for 2500 times and the
       | sum is all around 8500! I wonder what would be the results for
       | 25/250 times? So, this is sum(expectations).. and for rolling a
       | die, it is 3.5 [(1+2+3+4+5+6)/6 => 21/6], so the answer was 3.5 x
       | 2500 = 8750. Should hold good for all numbers relatively large.
        
         | matja wrote:
         | https://en.wikipedia.org/wiki/Law_of_large_numbers
        
         | alskdjflaskjdhf wrote:
         | This is a classic illustration of the Central Limit Theorem--in
         | fact, the example is even on the Wikipedia page [0]. The
         | distribution tends towards a normal distribution as n increases
         | (though to actually take the limit you need to rescale).
         | 
         | [0]
         | https://en.wikipedia.org/wiki/Central_limit_theorem#Applicat...
        
       | amir wrote:
       | to disable retweets on Twitter you can add "RT @" to the list of
       | muted words
        
       | punnerud wrote:
       | Using print in Python to generate HTML and piping the output to a
       | file:
       | https://gist.github.com/jvns/a552895b6f9b523276e88d7e7506ee8...
       | 
       | Always used append to file, but this is easier to debug/iterate.
       | Thanks for the trick.
        
       | pkdpic wrote:
       | Yes! Tiny programs! And from one of my favorite zine makers and
       | big inspirations for switching careers / getting a programming
       | job. I need to make more of these at work. API team too busy to
       | build an endpoint my team needs literally every day? No shame in
       | making a mini webscraper and never wasting another minute asking
       | them :^)
        
       | unforswearing wrote:
       | I am self-taught and little scripts like these were my entry into
       | programming. Favorite programs of mine include a script to tell
       | me when a boutique guitar pedal would be available from the maker
       | to avoid paying +200% markup in the reseller market[0], and more
       | recently I created a "todo focused markup language"[1].
       | 
       | [0]:
       | https://gist.github.com/unforswearing/db73475f333809119ae3dd...
       | 
       | [1]: https://github.com/unforswearing/todo_markup.js
        
       | davchana wrote:
       | I made a html js + google apps script timesheet thing, its at
       | https://spa.bydav.in/tsDMV/
       | 
       | A simple html js collects my time and date, and come fields, and
       | ajax it to Apps Script running as web app.
       | 
       | Script logs it into a sheet, recent rows on top.
       | 
       | The html page has a link to get the timesheet. On click, it again
       | asks the apps script to send back this month's time sheet data as
       | json, shows it as a table.
       | 
       | Although no chance, but still all of these ajax expect a
       | password.
       | 
       | ====
       | 
       | Recently I got into telegram bot, a multi bot. It has a /help
       | command. Help describe the expected command keywords. Backend is
       | again Google apps script. A string split, an switch case.
        
       | hughrr wrote:
       | I had a 200 line python script running on a junker PC that pulled
       | a not insignificant amount of cash in. It was an arbitrage system
       | that looked for poorly listed items in a couple of eBay niches.
       | I'd literally buy the items it identified and then list them
       | properly and reship. Average margin was 60%. On one occasion I
       | managed to nab something for PS15 and resell for PS675 with a 4
       | day turnaround.
       | 
       | Alas I collapsed the whole niche in the end.
       | 
       | Edit: all it did was every 10 minutes scrape some carefully
       | crafted eBay searches with beautiful soup 4, do some custom
       | filtering, remove any duplicate items it had already seen (stored
       | in redis), then send me an email via SES with the links in it
       | where I would make a decision.
        
         | kzrdude wrote:
         | Can you tell what the niche was? Collectible items or not?
        
           | hughrr wrote:
           | Not collectible. Specialist portable industrial equipment is
           | all I'm saying :)
           | 
           | The script was almost irrelevant compared to the discovery of
           | the niche.
        
       | simlevesque wrote:
       | Thank you for the Fringe calendar !
        
       | sailorganymede wrote:
       | My parents work at a care home and every now and then, they will
       | have a funny issue that I'll try solve with code. Like, the staff
       | tried going paperless so important documents needed to be hosted
       | somewhere and a QR code was used to link them. It's little things
       | like this that honestly bring so much joy
        
       | frans wrote:
       | My tiny program regularly scans a dropbox folder. If it finds a
       | pdf, it prints it and moves it to an archive folder. That was
       | just to avoid every family member emailing me documents so it is
       | nicely printed by the time they get home to study.
        
         | Zircom wrote:
         | That's brilliant, my girlfriend and roommates refuse to install
         | the printer driver onto their computers and print things
         | themselves so it's an endless cycle of bugging me to print
         | things. Going to get this going when I get home today.
        
       | senko wrote:
       | Love these kinds of projects! To me they represent what's the
       | most fun in programming.
       | 
       | Here's a couple of mine:
       | 
       | * During COVID lockdowns, the local grocery chain delivery slots
       | were reserved a week or more in advance, but they were opening up
       | a few slots each day; I wrote a scraper that would detect a newly
       | opened slot and ping me on Slack, saving me a few days' wait on
       | each delivery.
       | 
       | * When I was buying a house, I wrote a scraper that would email
       | me daily with what was new on the market; didn't end up buying
       | through that, but I later repurposed it to check for used car
       | classifieds and snatched a pretty nice deal.
        
       | TrapLord_Rhodo wrote:
       | >("using the API of local services" seems to be an ongoing theme,
       | one of my favourite things is to use secret undocumented APIs
       | where you need to copy your cookies out of the browser to get
       | access to them)
       | 
       | Would love more information about this one
        
         | bloqs wrote:
         | This is something I could never grasp. How on earth do you
         | discover those things?
        
         | jrkatz wrote:
         | A basic step for securing a resource intensive API from DDOS
         | attacks and some user impersonation attacks is to rely on a
         | security token in a cookie set in the response to an earlier
         | request. For example, a user may land on a web page and receive
         | a unique, encrypted, short-lived security token cookie that is
         | marked http only (inaccessible to javascript), plus a copy of
         | the token in cleartext. When the user agent later polls an
         | expensive API, it must send the cleartext token as part of the
         | request. Server-side, that's compared to the encrypted copy
         | (received from the cookie) and the expensive call is terminated
         | early if they do not match.
         | 
         | A DDOS attack that relies on a malicious ad or web page
         | directing user agents to poll your expensive API in a loop will
         | no longer work as well, because those user agents will not have
         | the correct security token cookie value, and the attacker is
         | unable to figure out what the correct value is for any given
         | user agent running their malicious code. More
         | sophisticated/expensive attacks are still available, but
         | anything is an improvement.
         | 
         | There are a few ways to skin this cat, so don't refer to the
         | above as a how-to-guide - find a more authoritative voice on
         | best practices than me, please, if you try to implement
         | security like this.
         | 
         | Anyhow, if you want to use an API implementing security like
         | this, you copy the cookies out of your browser and feed them to
         | your program so it can add them to the calls.
        
       | prometheus76 wrote:
       | This is super basic, but I finally sat down and learned the
       | syntax for yt-dl and built a script for checking all of my
       | favorite channels on youtube for any new content and archiving
       | them locally. I was doing it manually before and that turned into
       | a huge pain as my list of channels I wanted to archive continued
       | to grow.
       | 
       | Now it runs every night and I get notifications if it runs into
       | errors.
        
       | bonestamp2 wrote:
       | When my wife and I were looking at buying an investment property,
       | I built a little program to use Zillow's API to get tons of data
       | for a particular area, make some calculations, and then sort the
       | data in order of most potential profit as a rental (based on
       | their estimated rental rates, which are not always perfect of
       | course). Then I added some filters so I could find a property
       | that met our other criteria.
       | 
       | It worked really great, and we never ended up buying a property,
       | but I couldn't help thinking this is a premium feature that
       | Zillow could easily offer and charge for. If anybody at Zillow is
       | interested, feel free to reach out.
        
       | prova_modena wrote:
       | I wrote a tiny program to help test the tire pressure sensors on
       | my car. You can receive signals from these sensors using a cheap
       | SDR dongle and a program called rtl_433. However, out of the box
       | the process is bit messy and requires tweaking and
       | interpretation. So I wrote a bash script that wraps rtl_433,
       | guides you through the process in an easy-to-understand way and
       | summarizes the results.
       | 
       | A program like this is not full automation, but it greatly
       | reduces the cognitive overhead of doing this task. Now when I
       | suspect a sensor is bad, I can just pull out the script without
       | having to get back up to speed on how to orchestrate the
       | component programs and interpret the results. It's like having a
       | well-designed jig for a woodworking task, hanging on the wall for
       | later use.
       | 
       | Writing tiny programs like this is really satisfying because the
       | scope is small enough that I can carefully consider all
       | decisions. I spent a lot of time reading through guides and code
       | samples, considering dependencies vs pure bash, understanding
       | shellcheck warnings, and making the code conform to a style
       | guide. All not strictly necessary to achieve the goal, but I
       | learned a lot and take satisfaction in a small, but refined
       | result.
        
         | el_benhameen wrote:
         | Do you have the code for this living anywhere? I think I have a
         | bad TPMS sensor in one of my tires and it sounds like your tool
         | would be immensely helpful in figuring out which one.
        
         | ajolly wrote:
         | Feed rtl_433 into home assistant, can easily create alerts
         | based on the output.
        
       | jessetemp wrote:
       | Can anyone elaborate on "secret undocumented APIs where you need
       | to copy your cookies out of the browser to get access to them"?
       | That sounds fascinating
        
         | mynameismon wrote:
         | So as a part of my daily activities, I have to use a portal
         | that has an absolutely terrible interface, with text reflowing
         | on every click, parsing and loading a 1 MB JSON file from an
         | internal API taking about 5 minutes (of course, its a janky SPA
         | with developers filling it with useless JS).
         | 
         | Irritated, one day, I fired up dev tools, opened the Networks
         | tab and copied the relevant API request that was being fired as
         | a bash command, converted it to Python [1]. After that, I
         | merely parsed the JSON, dumped it into a HTML file, and saved
         | it on my hard drive so I wouldn't need to login to the portal
         | again.
         | 
         | [1]: https://curlconverter.com/
        
         | gen220 wrote:
         | If you look at the `network` tab in developer tools, you'll see
         | every http request made by your browser, and the headers that
         | are sent along with the request.
         | 
         | e.g. when you hit the `reply` button in HN, it'll make some
         | HTTP request, with a cookie in the header that identifies your
         | user session.
         | 
         | You can right-click on the request and click "copy request as
         | curl", and then paste it into a terminal to duplicate the
         | request locally.
         | 
         | Fore example, Stripe has some API endpoints that are only
         | available to logged-in dashboard.stripe.com users. They are not
         | documented in the public API spec, and they have more powers
         | than the public API. If you do the actions in the dashboard and
         | record the requests, you can use those undocumented APIs: all
         | you need it a session token!
         | 
         | This leads down an unstable path, where you write a browser-
         | emulating script to login to $service, scrape the cookie, and
         | then use the cookie to make requests against the $service's
         | undocumented API. Not a good idea to build companies on this
         | logic, but it's fine and fun for personal projects.
        
       | ckp95 wrote:
       | May as well flog the little zsh thing I wrote:
       | 
       | https://github.com/ckp95/fwf/
       | 
       | fwf -- "Filter With Feedback". It lets you write sed/awk/jq/grep
       | etc things interactively. You type in a UNIX filter, and on every
       | keystroke it renders the result in a column on the right, which
       | you can compare to the original on the left (watch the video
       | demonstration on the link if that description is confusing). I
       | wrote it to make the feedback loop for text-processing as quick
       | as possible. I use it all the time now. It makes the "activation
       | energy" for writing shell pipelines a lot lower, if that makes
       | sense.
        
         | belkarx wrote:
         | Very cool, thanks.
        
       | trickjarrett wrote:
       | Most of mine are one-time use or limited use. I have a few
       | ongoing dev projects for personal use:
       | 
       | - My smaller blog is a (poorly) written CMS that makes a static
       | site. Almost zero reason other than I wanted the experience of
       | building my own CMS, could easily use another tool.
       | 
       | - I have a 'Pick'em' with friends for MLS soccer. It's a fully
       | coded website, definitely my biggest ongoing project.
       | 
       | - I have a tool which looks at upcoming soccer games around the
       | world and recommends the best ones to watch (looking at a number
       | of variables such as relative ranking in the league, historic
       | goals for and against, gambling odds, etc.)
       | 
       | - I have a weight and body fat tracker I use to enter my daily
       | weigh in and see graphs and charts of my progress.
        
       | magamig wrote:
       | I did the same for the COVID vaccine
       | https://magamig.github.io/posts/scraping-for-a-covid-19-vacc...
        
       | nunez wrote:
       | Ages ago, I had a second job as a speed-dating host for a social
       | events company. I did it partly for the (beer) money, partly to
       | meet women at her other social events for free (she charged for
       | them), and partly to get her brash-but-actually-quite-useful
       | online dating advice (that helped me find my now-wife, now that I
       | think about it!).
       | 
       | The basic premise was simple: get 10-20 people into a hip
       | restaurant or bar, set up tables, have women pick the tables they
       | sit at, then have the men go from table to table having five-
       | minute conversations. After everything was said and done,
       | everyone would write the names of people they wanted to see again
       | on a form and hand them to me.
       | 
       | I would manually go through each form and send emails to matches
       | after the event was over. I also had a 24-hour soft SLO and a
       | hard 72-hour SLO. This usually took me a whole 2-3 hours to do
       | per event. I also mismatched people several times because humans
       | gonna human.
       | 
       | I was very fluent in PowerShell at the time, so upon realizing
       | that this can be automated with a matrix solver, I wrote a script
       | that took the names of everyone that submitted a form, then, name
       | by name, asked for everyone's matches, and sent everyone their
       | match emails from a template I wrote. It took me about six hours
       | to write and run through manual tests. (I know better now and use
       | TDD for everything!)
       | 
       | My 2-3 hour error prone process went down to five minutes, tops,
       | with no errors. It was beautiful. Towards the end of my stint
       | doing this job, I was able to run this script _as people gave me
       | back their forms_ and have emails queued up to send out once
       | everyone was gone. I spent the remaining 2.95 hours I got back
       | walking to my favorite izakaya and eating their amazing pork
       | belly rice bowl.
       | 
       | Thanks, Julia, for making me miss my twenties for the first time
       | in a while!
       | 
       | (I've written several small utility apps over the ages. It's a
       | shame when I hear people say that they actively don't program
       | outside of work; the ability to write code to bend the world to
       | your will is an amazing superpower!)
        
       | dbrgn wrote:
       | I can relate to the document scanning issue. In my case, I
       | digitize all documents I get on paper. For this, I've written
       | this wrapper around scanimage and ocrmypdf:
       | https://github.com/dbrgn/pydigitize
       | 
       | It does the following steps:
       | 
       | 1. Scan a document with any scanner that supports SANE (ADF
       | supported), 2. straightening and cleaning of scanned documents,
       | 3. run OCR on PDF so that it becomes searchable, 4. generate
       | PDF/A file for archival, 5. add keywords to the PDF file
       | 
       | I've probably saved many hours with this script, even when taking
       | into account the time it took me to write it.
       | 
       | Tiny projects don't always save time, but they sure are
       | gratifying when they work as intended!
        
         | BeetleB wrote:
         | I'll try your version out.
         | 
         | I went through this pain when I bought a document scanner some
         | years ago - there was no good solution on Linux that would let
         | me from the command line scan, clean, OCR, and output a PDF. I
         | found lots of scripts like yours, but none that was complete. I
         | finally took an existing Perl script and hacked it to my needs.
         | 
         | Features one should have:
         | 
         | 1. Output to PDF.
         | 
         | 2. Option to OCR (optional)
         | 
         | 3. Clean up (e.g. skip blank pages, straighten pages, etc)
         | 
         | 4. Allow one to specify quality/dpi
         | 
         | 5. Select grayscale vs color
         | 
         | 6. Duplex vs single page
         | 
         | 7. Dynamically recognize the size of the page.
         | 
         | The last one is the one I'm missing - if I scan something long,
         | it trims it to fit a Letter size page.
        
         | mindslight wrote:
         | I wrote a keypress-driven graphical utility that's basically a
         | wrapper around scanadf, that allows me to call scanadf
         | repeatedly, preview, delete pages, etc. For instance if a page
         | misfeeds, I pull the remaining stack out, delete the bad scan,
         | and restart from where it went wrong. When finished, the
         | graphical window disappears, and it writes all the current
         | pages out as an archive - the masters are checksummed,
         | compressed with FLIF, converted to some low quality JPGs, and
         | the whole thing is stuck in a ZIP archive with extension .cbz
         | (viewable with evince).
         | 
         | The eventual goal is to transcode all these masters into nicer
         | OCRed PDFs, but I've been making do with the low quality JPGs
         | just fine. Your script seems like a great starting point to
         | actually get this done!
        
         | chrisweekly wrote:
         | Cool project!
         | 
         | Related tangent: I haven't looked into OCR, but for a simple
         | "iPhone camera to 'scanned' PDF", the Dropbox iOS app has a
         | surprisingly good implementation.
        
           | jwong_ wrote:
           | I use the "Files" application from Apple, and it works pretty
           | well too.
           | 
           | I was surprised, and have largely made it my ingress for
           | receipts/paperwork.
        
           | dbrgn wrote:
           | I prefer not to upload all my potentially private documents
           | into a cloud service :)
           | 
           | OCRmyPDF (https://ocrmypdf.readthedocs.io/) actually does a
           | pretty good job! It also handles deskewing and all other
           | stuff that's necessary for good OCR results.
        
         | zem wrote:
         | her script reminded me that i never did get my scansnap working
         | properly under linux :( will have to give it another go
         | sometime.
        
       | Nouser76 wrote:
       | I have a local media collection that I like to have as background
       | noise/entertainment while I work. One thing I didn't like about
       | self-managed libraries vs radio/television/etc. is that I still
       | had the cognitive load of choosing what to watch, specifically.
       | So I wrote a small program to take a list of shows and shuffle
       | them[0] then interleave episodes. Depending on when you start
       | this channel, it has a time offset so you're dropped in the
       | middle of an episode (just like channel surfing!), and has
       | support for showing a certain show only in sequential order[1],
       | and even adding commercials between episodes.
       | 
       | [0] Native shuffle in my media player didn't feel random enough,
       | with a poor play count distribution. Switching to
       | programmatically shuffling means I can also weight things so that
       | a specific show is more/less likely to show back-to-back.
       | 
       | [1] I actually only consider the smallest continuous run of
       | unwatched episodes, starting from the end of the series, and
       | interleave vs shuffling the episodes.
        
       | somishere wrote:
       | Love this stuff. I use regular mini side programs/projects as
       | motivation-boosting procrastination tools. Oxygen to a tired
       | mind. Just yesterday I saw a front page post on hn that I didn't
       | love the solution for and so took 3hrs to byo (3hrs from another,
       | only slightly less-tiny, project). Often tiny programs form the
       | seed of much bigger efforts. My last two major projects, both now
       | well-funded scientific programs, can be found buried in tiny-
       | program / MIT form on my codepen. In fact looking at it again now
       | I have a codepen littered with tiny personal programs, most of
       | which are utility-driven, I'd completely forgotten about, and
       | would make no sense to anyone else.
        
       | vorvac wrote:
       | Back in high school I would try to play CS 1.6 on the library
       | computers. The librarians had access to screen viewing software
       | on all computers in the library and quickly caught me every time.
       | 
       | I played around with visual studio C# and created an application
       | that would continuously monitor running applications (every X
       | ms), detect when a specified .exe was found, and either (1)
       | constantly kill it, (2) display a message, or (3) run a different
       | .exe.
       | 
       | Never quite got to s1mple's level, but I did play a good amount
       | of CS after that!
        
       | sanderjd wrote:
       | Here's mine: Back in like 2006 when I was in college and they
       | first released games on facebook, there was a game my friends
       | liked that was multiple choice, matching song lyrics to artists
       | (if I remember correctly). It was always four choices, you would
       | get points for a correct answer and not lose any for an incorrect
       | answer, then there was a leaderboard amongst your friends. So I
       | thought clearly the right way to win this game is to write a
       | program that just chooses randomly (actually I think it just
       | always chose the first choice), but as quickly as the server will
       | allow. My poor friends woke up the next morning to find I had
       | about 1000x their points. A fun hack, but I also regret it
       | because it ruined a fun game for me and my friends; I couldn't
       | figure out how to reset my score.
        
       | jgrahamc wrote:
       | I wrote a bunch of Lotus 1-2-3 code for a small business in 1991.
       | Got paid cash which paid for an entire six week Amtrak adventure
       | round the US.
        
       ___________________________________________________________________
       (page generated 2022-03-09 23:00 UTC)