I wanted to share a small project I’ve been working on - a simple jigsaw puzzle embed that you can add to any website. What It Does It’s a straightforward tool that lets you embed customizable jigsaw puzzles into your web pages. You can: Use any image as the puzzle Choose the background color Set the difficulty by adjusting the number of pieces When someone completes the puzzle, it sends a “puzzleSolved” message that your site can detect. How to Add It Just include this iframe in your...| Welcome on Ishan Das Sharma
A0lite-js is a web-native chess engine that is compatible with Leela Chess Zero Networks| Ishan Das Sharma
Have you ever wanted to send desktop notifications from your command line on macOS? This can be particularly useful when you want to be notified when a long-running process completes. For example, you could append ; notify "Task completed!" to any command. While there are several ways to do this, I find using AppleScript through the osascript command to be the simplest approach. Here’s a handy shell function that lets you send notifications with just a single command.| Ishan Das Sharma
and How Buttons Saved the Day| Ishan Das Sharma
Ever stumbled upon a weird problem and couldn’t quite figure out where things went wrong? I’ve been there, and so has a friend of mine while tackling a HackerRank challenge. The task seemed simple: take a mathematical expression as input and print out the result with three decimal places. However, getting there wasn’t as straightforward as expected. Let’s walk through what happened and how we can apply the lessons learned to similar problems. The Initial Problem The challenge required...| Welcome on Ishan Das Sharma
How I built a post recommendation feature for my blog using text embeddings, GPT-4 and ChromaDB with LangChain| Ishan Das Sharma
Understanding Logarithms Better With This Cool Trick| Ishan Das Sharma
Editor’s Note Welcome to the inaugural issue of my newsletter! Launching this newsletter has been a long time coming. While my blog has been the primary platform for sharing my thoughts and polished work, I’ve held off on creating a newsletter until now. In this space, I aim to offer you a closer look behind the scenes, sharing the journey of how certain projects and transitions came to life. For instance, the process of building the interactive jq guide was both exhilarating and challeng...| Ishan Das Sharma
I’ve been trying to be more regular about showing my work. This newsletter is part of that endeavour. I know I have an aversion to sharing incomplete work because I worry about what people will think. This is where I try to change that. What will you get by subscribing? Once a week max. No spam, I promise! Catch up on any new blog content since the last issue. Expect sneak peeks, early access, or even some exclusive content.| Ishan Das Sharma
Featured Photo by energepic.com I’ve had a love-hate relationship with Bootstrap for a long time. While I love how fast it lets me get going, I absolutely hate the cookie cutter vibe of most of the stuff that I end up making with it. Bootswatch is awesome, and I know that I could customize my theme with SASS variables, but that adds a build step, which is additional complexity that I want to avoid when I am making business/CRUD applications.| Ishan Das Sharma
When beginning to use the terminal, we might accidentally delete our .bashrc file. What is the .bashrc file? The .bashrc file is a configuration file used by the bash shell. It contains all the environment variables, user defined functions, aliases and other config including the prompt layout. It is a full-fledged shell script, so we can have custom commands in it as well, which runs all the commands when a new process of the shell is started.| Ishan Das Sharma
To all those who ask why I haven’t been putting more posts out, this is for you Dear Members of the Cult of Not Done, I present to you a manifesto of not done. This was inspired by Kio Stark and Bre Pettis, and written over five days because it was, obviously, not done. The Cult of Not Done Manifesto There are four states of being. Not knowing, action, refinement, and completion.| Ishan Das Sharma
Dear past me, I know you’ve just launched your first desktop application. It’s a nightmare isn’t it? Well you’re in for a bigger one. Your boss calls you, and they need a new feature immediately. You bang it out and send out the update. Oh yeah, that’s right. You didn’t include an update mechanism. Please use one, you’ll save yourself a lot of pain. You send out the update to users, but soon you find out everyone hasn’t updated yet.| Ishan Das Sharma
I was returning from Saturday brunch with my friend a month or so ago. We took the metro back from the restaurant, and it was quite crowded. While disembarking from the metro, my leg slipped (or maybe I was pushed, I don’t know), and got lodged in the gap between the train and the platform. In my vigorous attempts to free myself, I twisted one knee and scraped the other.| Ishan Das Sharma
Every system has a hidden, "natural" structure of how data flows through it. Learn how to find it.| Ishan Das Sharma
The term Natural Selection is often misused, with people saying things like: natural selection at its finest or he’s about to win a Darwin Award when they see people doing things that are questionable. Not only is this a huge festering pool of negativity, but it actually totally misses the point of natural selection. Natural selection is the process by which those animals and plants which are best suited to the conditions in which they live have more young and live longer.| Ishan Das Sharma
Following an interesting discussion on programming.dev after the last article, I thought it would be good to add some extra notes regarding Webfinger. Webfinger provides a standard API for discovering the user profile details and avatar from the username, no matter the software running on the node. The standard Webfinger endpoint is /.well-known/webfinger. It must always be queried with at least the resource. Some examples using my account on Lemmy (programming.| Ishan Das Sharma
Find out how the humble .well-known directory is actually chock-full of bonuses that will make your web development life easier.| Ishan Das Sharma
Assuming that the IP addresses are in a file called list.txt in a format such as below: 1 2 3 4 5 6 7 8 9 104.28.29.66 92.40.175.51 116.255.32.201 91.150.51.170 108.167.20.103 5.187.159.175 166.198.250.121 74.78.184.213 ... A prerequisite for this is the geoiplookup command, which is available in the geoip-bin package on most distros. Run the following command to get the frequency distribution: 1 cat list.txt | xargs -n 1 geoiplookup | sed 's/GeoIP Country Edition: //g' | sort | uniq -c | sor...| Ishan Das Sharma
The following script can be used to start list the running containers inside a particular network along with their ips. 1 2 3 #! /usr/bin/zsh echo "Image\tHostname\tIP"; for N in $(docker ps -q) ; do echo "$(docker inspect -f '{{.Config.Image}}\t{{ .Config.Hostname }}\t' ${N}) $(docker inspect -f '{{range $i, $value := .NetworkSettings.Networks}}{{if eq $i "custom_network_name"}}{{.IPAddress}}{{end}}{{end}}' ${N})"; done Usage example: 1 ./network-hosts Bonus tip: Pipe the output into column ...| Ishan Das Sharma
Given a yaml-like file containing key-value pairs like this: 1 2 3 key1: value1 key2: value2 key3: value3 The following function will load it and return the data as a Lua table. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 function read_yaml_file(filename) local file = io.open(filename, "r") if not file then return nil, "Failed to open file: " .. filename end local data = {} for line in file:lines() do local key, value = line:match("(%w+):%s*(.| Ishan Das Sharma
The following script can be used to start a container inside a particular network. Usage example: 1 2 ./start-in-network redis ./start-in-network vad1mo/hello-world-rest 5050 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 #!/usr/bin/zsh if [ $# -eq 0 ] then echo "syntax: ./start-in-network container-name [container port binding]" echo "You must provide at least container name" exit 1 fi docker_container_id="" if [ $# -eq 1 ] then docker_container_id=$(docker run -d $1) else docker_container_id=...| Ishan Das Sharma
Create a file ~/.ssh/config If you have 2 keys, for example: id_rsa for your personal, and id_work for your work, set the config as: 1 2 3 4 Host github-work HostName github.com IdentityFile ~/.ssh/id_work IdentitiesOnly yes Now, when cloning or adding remote, change the github.com in the clone url is changed to github-work 1 git clone git@github-work:username/whatever.git| Ishan Das Sharma
Given two unix timestamps, this Python script fetches all the leads received by a particular Facebook Lead Ads form using the Facebook v14 Graph API. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 import json import requests # Constants ACCESS_TOKEN="YOUR_ACCESS_TOKEN" LIMIT=500 FROM_TIMESTAMP=1678613400 UPTO_TIMESTAMP=1678704000 FORM_ID=12341241244 def create_api_url(form_id): return f"https://graph.| Ishan Das Sharma
Many people who know me ask me why I haven’t got a personal website or blog. I often don’t know what to tell them. It’s certainly not for a lack of trying. Here’s one of the very first blogs I started to help my 7th grade classmates learn programming which they weren’t able to understand in school: I fumbled around various other blogs, but never managed to be able to post consistently.| Ishan Das Sharma
There is a bug in WSL2 that causes the clock inside the VM to drift behind the actual clock on the machine. This can lead to many unexpected issues, ranging from harmless (git commit messages having old timestamps) to severe (SSL connection failures). We can sync the VM clock using the command 1 sudo hwclock -s We can also add the command as a cron job every 5-10 minutes to make sure that the clock doesn’t drift too far back.| Ishan Das Sharma
Hi There, I’m Ishan. I was fascinated by coding from a young age. I taught myself how to code from the ground up, and I have never stopped learning and exploring new possibilities. Over the past ten years, I have worked on various projects that challenged me to grow as a coder and a problem-solver. I have learned how to build software that is reliable, scalable and performant, and that serves the needs of millions of users.| Ishan Das Sharma
Add the following lines in your service definition file (/etc/systemd/system/service_xyz.service) in the [Service] section: 1 2 ExecStartPost=/home/service_xyz/hooks.sh start ExecStopPost=/home/service_xyz/hooks.sh stop In /home/service_xyz/hooks.sh, put 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 #!/bin/bash hook_url=https://discord.com/api/webhooks/xxxxxxxxxxxx/yyyyyyyyyy case "$1" in start) curl -H "Content-type: application/json" \ -X POST -d \ '{ "content":"Hook: <NAME>; Act...| Ishan Das Sharma
Quickly and easily generate a key pair for passwordless connection. Also works perfect as git deploy keys! Generate the keys DO NOT DO THIS AS ROOT Run the command to generate the keys 1 $ ssh-keygen -P "" -t rsa -b 4096 -m pem -f my-key-pair -b flag sets the bits, 4096 is recommended -m pem is needed to generate a file in RSA Private Key format, not in OpenSSH Private Key format -f specifies the output key pair replace my-key-pair with the name of your key pair (preferably deploy_key or acce...| Ishan Das Sharma
Navigate to Repository > Settings > Secrets > New Repository Secret Set the name as SSH_PRIVATE_KEY Paste the contents of the key file 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 # .github/workflows/build.yaml name: Build and Deploy PROJECT_NAME on: push: branches: - main jobs: build: runs-on: ubuntu-latest strategy: matrix: node-version: [14.| Ishan Das Sharma
Setting up a local Postgres development environment 1. Install Postgres Download the installer from EnterpriseDB Run the installer Install Postgres into C:\xampp\pgsql{version_number} folder 2. Enable PostGres modules for PHP Open php.ini file located in C:\xampp\php. Uncomment the following lines in php.ini 1 2 extension=php_pdo_pgsql.dll extension=php_pgsql.dll 3. Install Adminer Download Adminer Place the PHP file into HTDOCS 4. Wrapping up Restart Apache Adminer is now accessible here| Ishan Das Sharma
Given a list of items and a separator, render it in a single line, with separators between. 1 2 3 4 5 6 7 $items = [ "apples", "oranges", "bananas" ]; $separator = " / "; Method 1: Basic foreach This approach is the one that comes to mind first, but it is incorrect because it will emit an additional separator after the last element. 1 2 3 foreach ($items as $value) { echo $value .| Ishan Das Sharma
A note to the reader This post is a legacy post. The legacy posts that are available on this website were written many years ago. These posts are made available here for archival purposes only. They reflect the age I was, and the level of knowledge that I had when I wrote them, and they may contain outdated information, so please keep that in mind as you proceed to read this article.| Ishan Das Sharma
A note to the reader This post is a legacy post. The legacy posts that are available on this website were written many years ago. These posts are made available here for archival purposes only. They reflect the age I was, and the level of knowledge that I had when I wrote them, and they may contain outdated information, so please keep that in mind as you proceed to read this article.| Ishan Das Sharma
A note to the reader This post is a legacy post. The legacy posts that are available on this website were written many years ago. These posts are made available here for archival purposes only. They reflect the age I was, and the level of knowledge that I had when I wrote them, and they may contain outdated information, so please keep that in mind as you proceed to read this article.| Ishan Das Sharma
This is a legacy script from when I was 13 years old. Please don’t give me a hard time 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 #!/bin/bash function speedTest { # ripped off from http://freevps.us/downloads/bench.sh local the_speed=$( wget -O /dev/null "http://$1" 2>&1 | awk '/\/dev\/null/ {speed = $3 $4} END {gsub(/\(|\)/,"",speed); print speed}') echo $the_speed } echo "jsTest.| Ishan Das Sharma
All content is licensed under CC BY-NC-SA 4.0. Copying is an act of love - please copy! | Ishan Das Sharma
All content is licensed under CC BY-NC-SA 4.0. Copying is an act of love - please copy! | Ishan Das Sharma
Learn how to search, query, and modify JSON data with 25 interactive jq examples and explanations| Ishan Das Sharma