Skip to content

Instantly share code, notes, and snippets.

View paxinla's full-sized avatar
🛰️
Remote work

Charles P paxinla

🛰️
Remote work
View GitHub Profile
@paxinla
paxinla / psqlrc_example.sql
Created June 18, 2021 02:41
example_psqlrc
\set QUIET 1
\set ON_ERROR_ROLLBACK interactive
\set VERBOSITY verbose
/* psql escape codes:
%M - full host + domain for db server, or [local] (if over Unix socket), or [local:/dir/name]
%m - host name of the db server, truncated at the first dot, or [local] (if over Unix socket)
%> - port where db server is listening
%n - database session user name (changes based on SET SESSION AUTHORIZATION)
%/ - current database name
CREATE SCHEMA pgbouncer AUTHORIZATION pgbouncer;
CREATE OR REPLACE FUNCTION pgbouncer.get_auth(p_usename TEXT)
RETURNS TABLE(username TEXT, password TEXT) AS
$$
BEGIN
RAISE WARNING 'PgBouncer auth request: %', p_usename;
RETURN QUERY
SELECT u.rolname::TEXT
@paxinla
paxinla / DFS.py
Created June 17, 2020 03:17
DFS的前中后序遍历
#!/usr/bin/env python
#coding=utf-8
class Node:
def __init__(self, val, left, right):
self.val = val
self.left = left
self.right = right
@paxinla
paxinla / build.sc
Created May 6, 2020 02:20
Build config of Mill
import mill._
import mill.scalalib._
import mill.modules.Jvm
import coursier.maven.MavenRepository
trait DefaultAppModule extends SbtModule {
def scalaVersion = "2.13.0"
val projectName : String = this.getClass.getName.split("\\$").last
@paxinla
paxinla / riemann.config
Created August 20, 2018 08:02
An example of riemann configuration file.
; -*- mode: clojure; -*-
; vim: filetype=clojure
; 日志
(logging/init {:console true
:file "/var/log/riemann/riemann.log"})
; 端口
(let [host "127.0.0.1"]