Aatish Neupane

Personal website of Aatish Neupane

  • Home
  • About Me
  • Github
tomcat

Multiple Tomcat instances in Fedora

Have you ever wondered why there's a folder /var/lib/tomcats/ adjacent to /var/lib/tomcat ? Just empty, nothing inside it?  Well the extra s is super helpful when you want to run

  • Aatish Neupane
    Aatish Neupane
1 min read
Catching Unique Constraint Errors in TypeORM and PostgreSQL
typeorm

Catching Unique Constraint Errors in TypeORM and PostgreSQL

IntroTypeORM is a really nice ORM layer that utilizes TypeScript features to provide a superior development experience. Coming from Djangoland where Django ORM is a bliss to work with, TypeORM seems like the

  • Aatish Neupane
    Aatish Neupane
3 min read
Metafield awesomeness with Shopify GraphQL API
graphql

Metafield awesomeness with Shopify GraphQL API

The GraphQL revolution in Shopify has made working with Metafields whole lot easier. The equivalent of "a picture speaks thousand words" in programming is a code sample. So here it goes: Create Product

  • Aatish Neupane
    Aatish Neupane
1 min read
Firefox

NS_ERROR_NET_INADEQUATE_SECURITY after Firefox upgrade

To fix the issue, update nss package when you update Firefox.

  • Aatish Neupane
    Aatish Neupane
1 min read
T480

Notes on using using Linux on Thinkpad T480

Notes on T480, NVMe and screen tearing issue.

  • Aatish Neupane
    Aatish Neupane
2 min read
React

GraphQL: Remove __typename in mutations

Apollo Client adds typename field for its InMemoryCache. Data from query, thus, cannot be used as-is for mutations. This article shows how to use Apollo Link to remove it automatically.

  • Aatish Neupane
    Aatish Neupane
1 min read
Devanagari

Devanagari/Nepali numerals in HTML lists

CSS list-style-property supports Devanagari as an experimental feature. We use this to show an enumerated list in Devanagari script.

  • Aatish Neupane
    Aatish Neupane
1 min read
Django

Django and Create-React-App together on Heroku

React is awesome. Django is great. And together, they can provide a clean separation of frontend and backend concerns. An ideal way to host React app is to serve it over a CDN

  • Aatish Neupane
    Aatish Neupane
5 min read
Django

Extract new rows in updated CSV file: Simple Tricks with Pandas

Problem Let's describe the problem visually. Say, I have a file with the following contents: Year Code Price 1995 X1 20 1996 X2 30 1997 X4 20 2000 X4 69 Then, we get

  • Aatish Neupane
    Aatish Neupane
2 min read
Django

Use JSONField with Django Rest Framework

There are multiple implementations of JSONField that can be used for storing arbitary JSON data in Django models: PostgreSQL specific model fields Third-party implementations The one I am using is jsonfield2 which is

  • Aatish Neupane
    Aatish Neupane
1 min read
Python

Comparing Floats in Python unit tests

When you are comparing floats in an unit test, a common notion is to round off the numbers being compared to some places. self.assertEquals(obj.change(), round(decimal.Decimal(0.471404524888533), 8)

  • Aatish Neupane
    Aatish Neupane
1 min read
Xpath

Negative indexing and slicing in Xpath

In Python, you could do list[-1] to get the last element. So, how do you do it inXPATH? Say, I want to get the last link in the navigation that is made

  • Aatish Neupane
    Aatish Neupane
1 min read
Django

Auto migrate Django in Heroku on push

In your Procfile, add the following: release: python manage.py migrate --noinput Heroku will run this command everytime you deploy the app. This command is run after all other commands so you can

  • Aatish Neupane
    Aatish Neupane
1 min read
Nginx

Remove specific cookie with Nginx

Snippet This snippet should remove some_cookie cookie from the request before passing it to the backend: set $new_cookie $http_cookie; if ($http_cookie ~ "(.*)(?:^|;)\s*some_cookie=[^;]+(.*)") { set $new_cookie

  • Aatish Neupane
    Aatish Neupane
1 min read
Angular

Fixing Angular infinite digest loops with Underscore's memoize

A quote I created for this scenario: When stranded in a place without a mechanic, you will learn to repair the bike on your own. I was getting errors like this: Error: $rootScope:

  • Aatish Neupane
    Aatish Neupane
2 min read
Django

Send HTML emails with Django

Below is a quick snippet on how to send HTML emails with Django. If you have email.html in your templates folder (either app or project-wide), you can do: from django.core.mail

  • Aatish Neupane
    Aatish Neupane
1 min read
Flask

Getting around Heroku's 30 seconds timeout limit with Flask

Heroku has this 30s request timeout window in which if your app doesn't send anything within 30 seconds, the request is cancelled and Application Error is returned. With Flask, there's an easy way

  • Aatish Neupane
    Aatish Neupane
2 min read
Linux

Deploying Django with Gunicorn and Nginx on Debian/Ubuntu

This tutorial will setup a Django environment running with nginx as a reverse proxy for the app. A gunicorn server will run our Django app i.e. gunicorn will act as a WSGI

  • Aatish Neupane
    Aatish Neupane
4 min read
Linux

Repairing broken downloads with Rsync

If you can download a file with size in GBs in a single session, you should feel a great sense of accomplishment, specially in Nepal where internet connection follows Heisenberg's uncertainty principle. Yesterday,

  • Aatish Neupane
    Aatish Neupane
1 min read
Android

Using LIKE constructs in Android SQLite Queries

I was using SQLite Database to cache things around in an Android application. I had to implement a search interface for cache's title column. I was using CursorLoader. So, how do we filter

  • Aatish Neupane
    Aatish Neupane
1 min read
Linux

Using SSH config for fun and benefit

If you have multiple servers to manage, you find yourself connecting to each of them a tedious task. Different private keys, different ports to connect, different hostnames and so many things to remember.

  • Aatish Neupane
    Aatish Neupane
2 min read
SRTM

Reading SRTM data with Python

Digital Elevation Model (DEM) provides elevation data for use in programs and analysis. These models have varied practical uses like line-of-sight and viewshed analysis. Shuttle Radar Topography Mission (SRTM), as the name suggests,

  • Aatish Neupane
    Aatish Neupane
4 min read
Linux

Writing Git Hooks in Python

Git hooks are a great way to execute something whenever a specified event happen in a Git repository. No wonder this website also uses Git hooks, mostly abusing post-receive. This post is not

  • Aatish Neupane
    Aatish Neupane
1 min read
Aatish Neupane © 2021
Latest Posts Twitter Ghost