I used to be a Google / Stack Overflow junkie for syntax issues or finding configuration/compatability issues in the vast amount of dimensions software gives us.
An approach I used to solve this problem was to document snippets once I have solved the problem (don’t forget to upvote the answer on SO). This is especially useful when you start learning a language. When you start learning a language, there are
- Syntax
- Style Guide
- Bad Practices to avoid
- Good Practices to start with
- Test cases to cover
- Libraries to use
- Libraries which are not upto date
- Highly opiniated frameworks
- The philosophy of the community
- Tooling
- Vendoring
- Advanced Syntax
- Backward compatible changes
- Where to find help instantly (when stuck)
- How to maintain, build and deploy
- The Database interaction
- The Spec (may be)
As a curious person wanting to learn everything you can with tens of open tabs, believe that once you start doing a project, you will eventually get to all these.
I started learning Elixir and it took me a while to get over syntax itself. I thought I would make a different approach while starting Go
. This is about in August 2016 that I started to write down (copy often) the code snippets and what they mean from the books I was reading.
Maintaining a cheatsheet in a 3 column layout for code snippets has been a huge time savor when I was searching on how was this done here. (well, may look better with Borders)
Example:
What |
Code Snippet |
Reference Link |
H1 heading |
# heading 1 |
Ref H1 Link |
Links |
[link](text) |
Ref Link |
I use a table
structure in Evernote for now which I will have to soon move to a Git Repo in markdown. Inspired by other cheatsheets I find, I have decided to make my own so that
- Help others work like me so that they dont have to search SO
- I can reference them from any where outside my private laptop
- Try to make the development world a better place
This approach has worked well for me when I was learning the Go
language and resuming my work on Ruby has made this better.
You can track any organisation’s new open source repositories or code changes in public repos from Github or Gitlab using Gitnotify.com
GitNotify
> Sign Up with Github
> Track Organisations
> sairam
When people tell me about their idea today, I generally start with just a few questions: Are you teaching anyone who looks like someone who would buy what you intend on selling? If not, why not? Why don’t you start a blog today targeting a typical customer and start posting 500 words every three days?
Read more at https://medium.com/@natekontny/a-litmus-test-for-your-idea-43fb44eda1c5#.b2e01u83h
The Challenge
Spend least amount of recurring money to monitor your application.
Frugality, one of the core principal had almost kind of became a habit from my first job at Amazon).
The Goal
Get notified when I am online when my server goes down.
Backstory: I am running the Open Source Go application on a single $5 Digital Ocean server. No Load Balancers, No fancy hardware, no high end configuration, no Docker, just the application running on Caddy for self signed Certificates, no vault
(https://www.vaultproject.io).
Ideally having another server monitor this process is the basic idea, but I did not want to setup/maintain another DO server in a different location.
Since pushing is not an option, polling is another
One of the options considered was Pingdom ~$7/month (free version is hidden which I found assuming while talking a friend later)
PagerDuty is one of the famous paying options of $9/month. Found few other solutions like Pingdom, but none of them had international calling or right integrations to notify me.
I finally I went down with was HealthChecks. The idea is to set an expectation of a cron which runs every X minutes etc., and meeting that expectation of cron finished running successfully or not. It has limits on the number of crons made per user and the history stored. I used Pushbullet extensively to pass websites from mobile to the desktop.
HealthChecks had integration with Pushbullet which helped me configure the notifications. A notification meant something went wrong with the server.
The script
while [ 1 ] ; do
t=$(curl -D - -s https://gitnotify.com/home | head -1 | egrep -o 200)
if [[ "$?" -eq "0" ]]; then
curl --retry 3 https://hchk.io/12345678-abcd-1234-abcd-123456789012
fi
echo -ne " $t "
date
sleep 58
done
The False Positives:
The health check used to fail occasionally there used to be errors occasionally with the curl command informing that it cannot resolve the IP address of the domain or could not connect to the server (from the gateway). I choose not to spend time on this problem though since it was intermittent.
I was generating logos for Git Notify’s Chrome Extension with the help of GoSpaces Tools. I have got a generic one in a decent sized banner. I had to crop off in the centre.
imagemagick
to the rescue. but the args? A simple Google search solved it.
convert input.jpg -gravity center -crop 25x25+0+0 output.jpg
source: Image Magick Forum
Fred Weinhaus has put together lots of Image Magick scripts.
One I was looking was to crop in the middle is called squareup
.
Look here if you want to generate your own logos
git log --reverse
Displays logs in the reverse order