Skip to content

Instantly share code, notes, and snippets.

@neeleshbisht99
neeleshbisht99 / customSetTimeoutAndsetInterval.js
Created October 14, 2022 05:12 — forked from ahmadalibaloch/customSetTimeoutAndsetInterval.js
custom setTimeout and setInterval for sandbox environments in browsers (vm-browserify or node-vm)
const setTimeouts = [];
export function customSetTimeout(cb, interval) {
const now = window.performance.now();
const index = setTimeouts.length;
setTimeouts[index] = () => {
cb();
};
setTimeouts[index].active = true;
const handleMessage = (evt) => {
if (evt.data === index) {
@neeleshbisht99
neeleshbisht99 / how-to-copy-aws-rds-to-local.md
Created January 12, 2022 09:52 — forked from syafiqfaiz/how-to-copy-aws-rds-to-local.md
How to copy production database on AWS RDS(postgresql) to local development database.
  1. Change your database RDS instance security group to allow your machine to access it.
    • Add your ip to the security group to acces the instance via Postgres.
  2. Make a copy of the database using pg_dump
    • $ pg_dump -h <public dns> -U <my username> -f <name of dump file .sql> <name of my database>
    • you will be asked for postgressql password.
    • a dump file(.sql) will be created
  3. Restore that dump file to your local database.
    • but you might need to drop the database and create it first
    • $ psql -U <postgresql username> -d <database name> -f <dump file that you want to restore>
  • the database is restored
@neeleshbisht99
neeleshbisht99 / tif_tools.py
Created August 10, 2021 07:38 — forked from jkatagi/tif_tools.py
Read GeoTiff and convert numpy.array to GeoTiff.
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import os.path
import re
from osgeo import gdal
from osgeo import gdal_array
from osgeo import osr