Skip to content

Instantly share code, notes, and snippets.

@chauvansang
chauvansang / wait_for_postgres.py
Created April 26, 2022 06:14
wait for postgres
import os
import logging
from time import time, sleep
import psycopg2
check_timeout = os.getenv("POSTGRES_CHECK_TIMEOUT", 30)
check_interval = os.getenv("POSTGRES_CHECK_INTERVAL", 1)
interval_unit = "second" if check_interval == 1 else "seconds"
config = {
"dbname": os.getenv("POSTGRES_DB", "postgres"),
"user": os.getenv("POSTGRES_USER", "postgres"),
@chauvansang
chauvansang / gist:fd59998e6600f4d419286ddcb57c004a
Created June 26, 2021 10:44 — forked from kaievns/gist:acb23149b66418ba340c
How to populate PostgreSQL with dummy data
CREATE TABLE t_random AS SELECT s, md5(random()::text) FROM generate_Series(1,5) s;
INSERT INTO t_random VALUES (generate_series(1,1000000000), md5(random()::text));
SELECT pg_size_pretty(pg_relation_size('t_random'));
@chauvansang
chauvansang / iterm2-oh-my-fish.md
Created May 18, 2021 08:43 — forked from normanlolx/iterm2-oh-my-fish.md
iTerm2 Solarized Dark theme + Fish shell + oh-my-fish /// macOS High Sierra
@chauvansang
chauvansang / 1-setup.md
Created May 17, 2021 04:37 — forked from troyfontaine/1-setup.md
Signing your Git Commits using GPG on MacOS Sierra/High Sierra

Methods of Signing with GPG

Last updated March 28, 2021

There are now two ways to approach this:

  1. Using gpg and generating keys
  2. Using Kryptonite by krypt.co

This Gist explains how to do this using gpg in a step-by-step fashion. Kryptonite is actually wickedly easy to use-but you will still need to follow the instructions

@chauvansang
chauvansang / Install NVIDIA Driver and CUDA.md
Created May 8, 2021 03:51 — forked from wangruohui/Install NVIDIA Driver and CUDA.md
Install NVIDIA Driver and CUDA on Ubuntu / CentOS / Fedora Linux OS
@chauvansang
chauvansang / Headless_Ethereum_Ubuntu_16.04.md
Created May 8, 2021 03:50 — forked from streslab/Headless_Ethereum_Ubuntu_16.04.md
Headless NVIDIA overclock setup under Ubuntu Server 16.04 for ethereum mining

Headless Ethereum Miner Setup - NVIDIA

Reed Slaby, March 2018

Having grown tired of wasting a perfectly good monitor on my ethereum mining rig, I finally decided to replace the Ubuntu Desktop 16.04 installation with Ubuntu Server 16.04. Many of the gtutorials available at the time of this writing range from unecessarily complicated to flat-out wrong. This guide is intended to address many of those shortfalls.

Prerequisites

To complete this guide, you should already have:

  • Basic knowledge of Linux
  • An Ethereum wallet
@chauvansang
chauvansang / install_quobyte.sh
Last active April 13, 2021 07:59
Install quobyte
export http_proxy=http://172.25.211.30:3128
export https_proxy=http://172.25.211.30:3128
yum install -y epel-release wget
wget "https://packages.quobyte.com/repo/v3/rpm/CentOS_7/quobyte.repo" -P /etc/yum.repos.d/
yum install -y quobyte-client
export DATASTORE=postgres://k3s:k3s@ep06:5432/k3s?sslmode=disable
k3sup install --user root --ip $SERVER1 --datastore="${DATASTORE}" --k3s-extra-args '--kube-controller-manager-arg=node-cidr-mask-size=22 --kubelet-arg=max-pods=500 ' --k3s-version v1.20.4+k3s1
##install helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh
helm repo add rancher-stable https://releases.rancher.com/server-charts/latest