Skip to content

Instantly share code, notes, and snippets.

PostgreSQL High Availibility on Kubernetes

  • Installation
  • Create PostgreSQL Cluster
  • Connect to a PostgreSQL Cluster
    • psql
    • pgAdmin
  • Updating PostgreSQL Cluster
  • High Availability
@bolerap
bolerap / app.js
Created November 19, 2020 04:39 — forked from joshnuss/app.js
Express.js role-based permissions middleware
// the main app file
import express from "express";
import loadDb from "./loadDb"; // dummy middleware to load db (sets request.db)
import authenticate from "./authentication"; // middleware for doing authentication
import permit from "./authorization"; // middleware for checking if user's role is permitted to make request
const app = express(),
api = express.Router();
// first middleware will setup db connection
  1. getInitialProps only works with component exported default by the page.
  2. Navigation via <a> will reload page because it call to remote API server, to navigation on client side let use wrapper component Link from "next/link"
@bolerap
bolerap / JAVA.md
Last active January 7, 2020 04:53

A. JDK

  1. install jenv by brew install jenv, install gradle by brew install gradle
  2. list installed java jenv versions
  3. install jdk by brew cask install java
  4. list all installed jdk /usr/libexec/java_home -V
  5. add JDK to jenv by jenv add <path> (paths get from step 4). eg jenv add /Library/Java/JavaVirtualMachines/openjdk-11.0.2.jdk/Contents/Home
  6. set JDK used by jenv global <name> (name get from step 2)

B. GRADLE

  1. specify build errors by ./gradlew --scan. At this step we can know what errors occurred (usually is mismatch versions of lib or JDK)

Cannot route message for exchange 'reply.celery.pidbox': Table empty or key no longer exists This issue occurred on kombu version 4.6.5 Try to upgrade to 4.6.7 the issue will be fixed

#!/usr/bin/env bash
sudo apt -y update && sudo apt upgrade -y && \
sudo apt -y install apt-transport-https ca-certificates wget gnupg && \
wget -q -O - "https://repos.ripple.com/repos/api/gpg/key/public" | \
sudo apt-key add - && \
echo "deb https://repos.ripple.com/repos/rippled-deb bionic stable" | \
sudo tee -a /etc/apt/sources.list.d/ripple.list && \
sudo apt -y update && sudo apt -y install rippled && systemctl status rippled.service && \
sudo systemctl start rippled.service && sudo systemctl enable rippled.service
@bolerap
bolerap / BasicERC20.sol
Created July 19, 2019 10:53 — forked from giladHaimov/BasicERC20.sol
Basic ERC20 implementation
pragma solidity ^0.4.19;
contract ERC20Basic {
string public constant name = "ERC20Basic";
string public constant symbol = "BSC";
uint8 public constant decimals = 18;
event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
@bolerap
bolerap / omni_raw_simplesend.md
Created June 28, 2019 07:33 — forked from dexX7/omni_raw_simplesend.md
Create raw Simple Send Omni transactions with Omni Core

The following example demonstrates the creation of a raw Omni transaction, which transfers 0.1 Test Omni with token identifier 2 from 1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc to 1Njbpr7EkLA1R8ag8bjRN7oks7nv5wUn3o, with a transaction fee of 0.0006 BTC. For the sake of a demonstration, more than one unspent output was consumed.

1) List unspent outputs

List unspent outputs for 1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc.

omnicore-cli "listunspent" 0 999999 '["1K6JtSvrHtyFmxdtGZyZEF7ydytTGqasNc"]'
uniqueArray = a => [...new Set(a.map(o => JSON.stringify(o)))].map(s => JSON.parse(s))