Înapoi la articole →

Cel mai recent articol

Ultima verificare

Urmăritori 0 urmăritori
Articole: 179
  1. If we have two tables, people and groups, where people has a column group_ids which is an array of ids from groups, we can map the array of ids to the matching name from groups using the following query: select p.email as email, coalesce(groups.na…

  2. 📝 Counting days between 2 dates in PostgreSQL

    payments customer_id payment_id payment_amount payment_date If you want to count the number of days between each payment and today then you can use extract function with days as a parameter: select payment_id, payment_date, extract(days from now()…

  3. 📝 Find the first entry in each group

    payments customer_id payment_id payment_amount payment_date If we want to see the payment_id of the highest amount of payment for each customer_id then we need to do: select distinct customer_id, first_value(payment_id) over (partition by customer_id…

  4. 📝 Navigate to a path in Mac Finder

    For many years I had a slight frustration with Mac's default file explorer utility Finder that it was not exposing any convenient way to go to a given path without making me click through those folders individually.

  5. Contacts Calendar

    I store birthdays of my contacts right in my contacts application on phone.

  6. Cheatsheet - ffmpeg

    Extract audio from .webm to .mp3 FILE="the-file-you-want-to-process.webm" ffmpeg -i "${FILE}" -vn -ab 128k -ar 44100 -y "${FILE%.webm}.mp3" Credits: Bytefreaks.net Merge subtitle (srt) files with video files ffmpeg -i video.mp4 -i subtitle.srt -c copy -c:s

  7. 📝 Most used commands

    Use this command to view the top-5 most used commands on your Mac terminal history | awk 'BEGIN {FS="[ \t]+|\\|"} {print $5}' | sort | uniq --count | sort --reverse --sort=numeric | head --lines 5

  8. 📝 wget with custom filename

    wget --output-document "<filename-goes-here>" --continue "<file-url-goes-here>"

  9. 📝 Taking a heap-dump from a running JVM process

    I was trying to find the root-cause of a memory leak and amongst many different rabbit holes, I learnt how to take the heap-dump from an application running on JVM.

  10. 📝 Figma styles not present in the API response

    So there can be the case that your Figma file is showing that there are styles defined and present in the file, but when querying it via the API endpoint to get file-styles (/v1/files/<file-id>/styles) it might return empty styles array.

  11. Office Pranks

    These are a bunch of simple and harmless (especially HR safe) pranks you can pull on your colleagues: Wear a different name tag every day Come to office with a different name tag stuck to your shirt every day.

  12. 📝 Authentication with wget

    There are 2 ways to provide username and password when downloading files using wget Directly as parameters wget --user "<username-goes-here>" --password "<password-goes-here>" "<file-url-goes-here>" This has the disadvantage that it will show up in your s…

  13. 📝 How to make non-capturing groups in RegEx

    TLDR: This is how you surround a regular (capturing) group in regex ().

  14. Useful fonts

    This is a list of interesting/useful fonts which can be used: Saira Chakra Petch Cinzel Lkdown Graph Katwijk Mono Turbeu Parkly

  15. 📝 India's national aquatic animal

    Today (well actually this past Sunday) I learned that nations also have something known as their "National Aquatic Animal" (NAA).

  16. Safe alphanumeric password base

    The below collection of characters are readable and individually distinguishable to make alphanumeric passwords out of abcdefghjkmnpqrstuvwxyABCDEFGHJKLMNPQRSTUVWXY3456789

  17. 🎲 Improvement Roll

    So I finally finished a side-project after a long time and rolled it out public.

  18. 📝 List files updated in a git commit

    I wanted to see the list of files committed in my last commit git show --pretty="" --name-only <sha1-commit-hash>

  19. 📝 Centering elements with CSS

    We can use flexbox to do this.

  20. Cheatsheet - ImageMagick

    Resize images to specific target size while padding remaining space with transparency convert -auto-orient -background "#00000000" original.jpg -resize 720x576 -gravity center -extent 720x576 resized.png Resize all images of a file-type inside a folder for

  21. 📝 Resizing images from command-line

    I had to resize a bunch of images today to a specific target size while padding the remaining space with a transparent background.

  22. Cheatsheet - YouTube-DL

    Use a separate file to record already downloaded URLs youtube-dl --download-archive archive.txt "https://www.youtube.com/watch?

  23. 📝 Comparing two BigDecimal instances

    If you have two instances of BigDecimal as following val a = 7.5.toBigDecimal() val b = 7.50.toBigDecimal() It seems that they are equal in value and should return true when doing a == b but they don't.

  24. Windows Symlink

    Context: Any file appearing to be stored in SourceDirectory are actually stored in DestinationDirectory.

  25. 500 Million, But Not a Single One More

    I found this awesome piece of writing a few months ago on the website Almost No One is Evil.

  26. 📝 Castle Under Threat

    In one of our chess games at work I learnt that you cannot perform the castle move with King if the blocks where the king has to pass through or end at are under threat from any of opponent's piece(s).

  27. 📝 Ugh fields

    I came across this concept the other day called "Ugh Fields".

  28. 📝 Opening current terminal command in $EDITOR

    If you are working with a long command in your terminal and want to edit parts of it, Ctrl+X followed by a Ctrl+E (don't lift your finger from Ctrl between them) will open the command you are currently editing into the program specified in your $EDITOR en…

  29. 🐘 Cheatsheet - PostgreSQL

    Dump database to a script (.sql) file Extract/Dump the database contents to a script (.sql) file pg_dump -f ~/path/to/file.sql $YOUR_DATABASE_URL Run a script (.sql) from file on a database Run SQL commands from a file on a database psql $YOUR_DATABASE_URL

  30. Tips when building a PC

    One of my friend emailed me today saying that he wants to build a RISC-V PC and was asking for any tips/advice on the basic dos and don'ts and suggested that I can make it into a blog-post.

  31. 📝 Google gives refresh token only once

    According to Google's docs on OAuth, the server application gets refresh_token from Google (on exchanging the auth code) only if the original redirection request to Google contains the param access_type with value offline (documentation link).

  32. 📝 JavaScript can "throw" the table

    Since JavaScript does not have the concept of a throwable type.

  33. 📝 CSS support for browser dark-mode preference

    There is a simple CSS media query with which we can specify styles only for dark mode or light mode.

  34. Why you should own your email address?

    This week I was talking to a friend and the discussion somehow turned onto emails.

  35. Challenge Update: Two and a Quarter Books

    So finally I couldn't finish the list of books from last post before the year ended.

  36. 2020: Year in review

    This will be the first year in review I have ever written.

  37. Java convert LocalDateTime to Instant using ZoneId

    Last week I was working on something which required me to convert LocalDateTime to Instant.

  38. Cheatsheet - Git

    This is first in my collection of cheat-sheets.

  39. Challenge Update: The Adventures of Sherlock Holmes

    Today I finished the second book for my end of year reading challenge.

  40. People who know me know that I care about my physical health, and due to that I have taken on numerous fitness challenges in the past to gamify my exercises and to keep myself consistent.

  41. Challenge Update: Around the World in 80 Days

    So I finished my first book for the challenge last night.

  42. Postel's Law

    This week I learned about a software principle that aims to make developer's lives easier.

  43. 2020 End of Year Reading Challenge

    This will be a really short post.

  44. Check if your request body is compressed

    Entering the maze Recently in one of the projects I was trying to make a POST request to an external API.

  45. Techniques to Improve Focus

    Recently I realized that my attention span and ability to focus have drastically reduced over the past 2 years.

  46. Interesting Stuff - Week 4

    Hi folks, these are the interesting things I found during this week.

  47. Interesting Stuff - Week 3

    Hi folks, these are the interesting things I found during this week.

  48. Interesting Stuff - Week 2

    Hi folks, this is the second edition of my new experiment where I list articles, podcasts, videos or basically anything I found interesting during last week.

  49. Interesting Stuff - Week 1

    Hi fellows, I am starting a new experiment, where I would be listing some articles, podcasts, videos or basically anything I found interesting that week into a post.

  50. Prevent back navigation to login screen

    There is a typical use-case in apps where once the user has logged in, you won't want them to return to login screens when they press back.