Ask HN: What is the most useful script for your business or startup? - david90
======
Sukotto
Thank you telling us about what happened. I am sorry to hear that [paraphrase
complaint]. We want all our customers to have a great experience and we let
you down.

I have [refunded / free upgrade / given some other bonus] your account. We
will also make it a priority to [describe how we will improve] to make sure
this doesn't happen to anyone else.

Please let me know if there is anything else we can do to make this right or
if you have something else to tell us. You can contact me by email
me@example.com or phone $phone_number. Those are direct to me personally, not
to our helpdesk.

Best regards

$me

~~~
david90
I have 3 seconds thinking this is a spam lol

~~~
onion2k
It's a response to a problem the customer has raised. In that context it won't
look like spam.

I'm not keen on the conciliatory tone and going straight to a 'bribe' of a
refund/offer/etc, but in some markets that could work. If I had it as a
response I'd feel like I was getting a brush-off rather than someone was
trying to engage with me and fix my problem. If someone is willing to go to
the effort of making a complaint without asking for a refund then they're
expressing an interest in continuing the relationship; a refund is often seen
as "we don't want your custom so we're paying you to go away." Like I said
though, it's very dependent on the market.

~~~
s_kilk
I think they meant the post looked like automated HN spam, until it 'clicked'
that it was just a dump of an email template :)

------
jlgaddis
My fellow employees and I are supposed to send a "time sheet" detailing how
many hours we work, how much time we spent working on "x" and "y", etc., via
e-mail every week (by noon on Monday for the previous week).

I have a cron job that fires off a Perl script at 8:45 a.m. every Monday
morning that composes that e-mail and sends it off for me.

On the rare occasion that I was on vacation the previous week (and forgot to
disable it), I just text our payroll lady and tell her to "ignore that e-mail,
I was on vacation last week".

She knows it's automated and she doesn't care. She's required to receive an
e-mail from me before she pays me and that satisfies her requirements. The
boss knows too, he just shook his head and laughed when I told him about it.

It sorta reminds me of how, when a "measure productivity by number of tickets
closed" policy gets enacted, everyone just starts creating tickets for every
menial thing they do.

My second favorite is the one that runs once an hour, deleting any IP
addressing / DHCP lease / similar data older than 24 hours (I work for an
ISP).

Sorry, IP-Echelon, the company policy (which I wrote and enacted) says we
don't keep that (IP <-> User) data for more than a day, so I can't "ensure the
user and/or IP address owner refrains from future use and sharing" because I
don't know and can't tell who it was.

~~~
crdb
> It sorta reminds me of how, when a "measure productivity by number of
> tickets closed" policy gets enacted, everyone just starts creating tickets
> for every menial thing they do.

I had a client who did this and so I started logging everything, pasting the
commits etc. with the start and end timestamp of each group of actions (e.g.
"created X table, met these issues, solved them like this").

Then I looked at the log and realised I was putting in way too many hours
compared to the contract because I wanted to get the job done well, and cut
back to the hours they were paying for.

------
akerro
The one that scans inbox for emails from "Kumar" (a DBA at our clients). Looks
for keywords like "help", "trouble", "sorry" etc. If keywords are found - the
script SSHes into the clients server and rolls back the staging database to
the latest backup. Then sends a reply "no worries mate, be careful next time".

More serious, I have a script that uses gitlab and gitlabci that integrates it
with FDroid repo and builds and publishes .apk on internal FDroid repo. Each
git branch, tag and release has its own publication in the repo where everyone
can test the app, also easy to find regressions by using the app before we use
git bisect.

~~~
kzisme
For those curious about what he is referencing:
[https://github.com/NARKOZ/hacker-scripts](https://github.com/NARKOZ/hacker-
scripts)

------
david90
I resize image assets for iOS to @1x @2x @3x with
[https://gist.github.com/david90/52a38b6279b7beabd7e8](https://gist.github.com/david90/52a38b6279b7beabd7e8)

~~~
prawn
Would ask my colleague to comment but he's on his honeymoon. He's recently
gone from creating App Store screenshots manually to using a script. For each
release, creates five or so screens, each for multiple device sizes multiplied
by 20+ languages. Can only imagine how much time it saves.

~~~
dalbin
I think your colleague is using Snapshot[0], which is a part of Fastlane[1]

[0]:
[https://github.com/fastlane/fastlane/tree/master/snapshot#re...](https://github.com/fastlane/fastlane/tree/master/snapshot#readme)
[1]: [https://fastlane.tools/](https://fastlane.tools/)

------
kzisme
These are not mine, but I still enjoyed reading about them and thinking about
the ideas behind them.

[https://github.com/NARKOZ/hacker-scripts](https://github.com/NARKOZ/hacker-
scripts)

------
vollmond
Nothing at my current position, but on a previous team we had a rigorous code
review policy without a tool (FishEye/Crucible, etc) to facilitate it. I wrote
a bash script that accepted a ticket number as a parameter. It scanned SVN for
all commits associated with that ticket.

For each file, it would diff the original version with the last version
committed against the ticket, and pop the diffs up sequentially in Vim (IE,
one end-to-end diff for each source file).

I'm sure there's a better way, but this worked well enough at the time.

------
herbst
Its not one specific script. But integrating Slack everywhere to get
notifications is almost always worth it.

~~~
pawelkomarnicki
I never got the Slack hype...

~~~
k__
Problem is, 99% of it is crap.

Slack is okay and there are some really good bots for it.

But everyone jumps on that train and so for every good integration there are
20 bad ones, that spam your channel with stuff no one needs to know :\

Takes a bit time to find the good things.

~~~
herbst
Most of my integrations (except github) are manually crafted. I agree that
most bots are just spamming shitholes. Especially the new generation of bots
that randomly reminds you to vote for them on some stupid bot stores.

------
guillaumec
I made a small script that uses pattern matching to automatically parse and
organise documents I get from various source (bank, clients, google, etc). It
renames the docs and copy them in the right location.

~~~
Manozco
Genuinely interested in this Do you mind sharing some details ? What kind of
documents, does the script fetch them automagically, etc ?

------
heartsucker
We had something like 40 NodeJS projects that were deployed with git or as
tarballs. I wrote this bash script, and now they're all Debian packages.

[https://github.com/heartsucker/node-deb](https://github.com/heartsucker/node-
deb)

------
jamespo
I recently wrote a python script that uses selenium/xpath to check the price
of items I'm interested in and emails me when they change... has already saved
me some money (or cost me, depending on your viewpoint).

~~~
dizrupt
Link to script?

~~~
akerro
camelcamelcamel.com

------
maxaf
The shell script that makes a ZIP file containing our code challenge in a
candidate's language of choice, uploads it to S3 for record keeping, and
reveals the ZIP in Finder, ready for drag/drop into an email.

------
azeirah
The button that when I press it deploys the new version of my thing. It's
nice, I like pressing it.

~~~
StavrosK
You mean "git push"?

~~~
azeirah
nonono it's a button

------
acesubido
Part of deliverables is for clients to have a list of IP's and base
configurations for the hadoop clusters we deploy for them. I have a WIP Ruby
gem that takes my ansible hosts and variables file along with the Ambari
blueprint, which turns it into a CSV and a neatly formatted Markdown file (the
latter I convert into PDF).

The next few steps is to upload these things to Google Drive for the clients.

------
steventhedev
Dayjob - server with intermittent memory issues and no budget to replace.
Hosts our primary code base, and corrupts the occasional packfile. I'm in the
process of writing a git-surgery script that automatically diagnoses fsck
issues and traverses remotes to copy back corrupted/missing objects.

side project - some stuff to import customer data dumps into the db quickly.
Not quite self-service yet, but getting there.

------
Vanit
Our engineers used to spend hours each week manually preparing stat reports in
excel to send to our enterprise clients. I wrote a library that is essentially
an excel templater that queries the database for the metrics, populates a
spreadsheet and emails it to the client. We've been integrating it into every
project for 5 years now.

------
suoinguon
Our script to automate deployment: running test, migrate db, collecting files,
push to production servers ... Peace!

------
chrisabrams
I wrote a bot that tells me when to buy and sell stocks. So far I've made
about 10k profit this year.

~~~
drmcninjaturtle
Where do you get the data?

~~~
BatFastard
indeed tell us more...

------
oelmekki
If I had to chose one, that will be my backup script, without any hesitation.
Data is by far the most important thing, nowadays.

After that, I would say the script that updates dependencies in all our
projects and make merge requests on gitlab if anything has been updated.

~~~
StavrosK
Didn't mention a testing/restore script? Found the guy with no backups!

------
simbalion
rsnapshot

------
codeddesign
Git

~~~
dijit
Git doesn't fit the definition of a script, it's a compiled program.

