Skip to content

Instantly share code, notes, and snippets.

View kapoorabhish's full-sized avatar

Abhishek Kapoor kapoorabhish

View GitHub Profile
@kapoorabhish
kapoorabhish / postgres.sh
Created October 27, 2020 18:15 — forked from mrw34/postgres.sh
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) == Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@kapoorabhish
kapoorabhish / min-char-rnn.py
Created January 19, 2019 11:39 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
@kapoorabhish
kapoorabhish / postgres_PITR.md
Last active July 6, 2018 16:36
Postgres Point In Time Recovery(PITR)

Postgres Point In Time Recovery

The is the tutorial for setting up Postgres Point In Time Recovery(PITR). This has been tried and tested on Postgres Server version 9.5 and Ubuntu 16.04. For other version of postgres server the steps should be similar.

Edit the postgresql.conf

First edit the postgresql.conf and make the below changers.

wal_level=logical
archive_mode=on  
@kapoorabhish
kapoorabhish / snomed_rf2_to_json_conversion.md
Created May 16, 2018 10:14
SNOMED-RF2-TO-JSON-CONVERSION

SNOMED rf2 to json conversion

The docs cover the conversion of Snomed data version 20180131. For other verions there may be slight difference in the steps.

Assumptions

OpendJDK 1.8.0_131 installed. JAVA_HOME environ variable is set. mvn version 3 is installed. cloned repo of https://github.com/IHTSDO/rf2-to-json-conversion. SNOMED SNAPSHOT data downloaded.