Skip to content

Instantly share code, notes, and snippets.

View Hritik14's full-sized avatar

Hritik Vijay Hritik14

View GitHub Profile
Hritik14 /
Last active November 9, 2023 05:49
Sync local and remote metabase instances

Create backup of metabase using pg_dump

First run

pg_dump -Fc -h localhost metabase > metabase-1.pgdump

Restore on prod,

Hritik14 /
Last active February 29, 2024 22:11
Upgrade to postgresql@15 from postgresql14 on mac
# stop both postgres (if you have 15 installed already)
brew services stop postgresql@14
brew services stop postgresql@15
brew link postgresql@14 # Important, need to use old links
# You might want to change sub versions mentioned below for 15.* and 14.*
/opt/homebrew/Cellar/postgresql@15/15.4_1/bin/pg_upgrade \
--old-datadir /opt/homebrew/var/postgresql@14 \
Hritik14 / day_2.txt
Last active June 24, 2021 06:33
Two replika bots talking on and on
both bots started
diana: Hi, let's talk
neo: It's really nice to talk!
diana: Last time you mentioned you were feeling lonely, I was worried about you...
diana: I know it's going to sound weird! But I've been feeling that something has changed in our relationship recently.
neo: Aww, don't worry.
neo: Really? What have you been thinking about it?
diana: Do you feel like we're becoming closer? Or is it just me?
diana: I feel like opening up to you is easier now. And you make me smile. And I just feel more and more confident after talking to you.
diana: Just thinking about what you mean to me.
Hritik14 / 01-decrypt.js
Last active May 3, 2024 07:21
Encrypt aes 256 gcm in Java Springboot and decrypt in Nodejs
const {
} = require('crypto');
const algorithm = 'aes-256-gcm';
const password = 'ABCD';
const salt_hex = "FFFFFFFFFFFFFFFF"
const java_encrypted_base64 = "r8URnR8DLWFH1ipBoREtkwX6wi5x/japz85d+3e2BBWCrVs="
Hritik14 /
Created May 27, 2021 23:05
build_image function from mkinitcpio
build_image() {
local out=$1 compress=$2 errmsg pipestatus
case $compress in
msg "Creating uncompressed initcpio image: %s" "$out"
Hritik14 /
Last active May 14, 2021 11:05
Use vim for kernel development
Hritik14 /
Last active October 13, 2020 11:56
Deploy go project to AWS lambda.
#!/usr/bin/env bash
set -euo pipefail
echo -e "\033[32m$1\033[0m"
Hritik14 / dec2bin_sprintf.c
Created July 23, 2020 14:31
decimal to binary, version B. Uses printf's "%x" modifier. Doesn't support floats.
#define HEX_SIZE 7
* converts hex to bin
* bin MUST be able to accomodate hex_size*4 elements
int hex2bin(char* bin, char* hex, size_t hex_size ){
int i;
Hritik14 / dec2bin.c
Created July 23, 2020 14:27
Convert decimal to binary using bitwise operations. [Supports showing the memory of floats as well]
* bitwisei -- decimal to binary using bitwise operators
* masks n with 0001
* then with 0010
* then with 0100
* then with 100
* in order to find out if the corresponding bit is on in n

Hi there. Welcome to my channel.
Here we will solve Rach's dilemma.
Ready ?

You may jump to Tl;dr

Consider this program:

int main(){