Skip to content

Instantly share code, notes, and snippets.

@xkou
xkou / ldback.sh
Created January 6, 2024 07:15
ldap backup restore
slapcat -n 0 > 0
slapcat -n 1 > 1
@xkou
xkou / start.sh
Created September 6, 2023 13:18
start openwrt vm
[ -e zImage ] || wget https://downloads.openwrt.org/releases/18.06.1/targets/armvirt/32/openwrt-18.06.1-armvirt-32-zImage -O zImage
[ -e root.ext4.gz ] || wget https://downloads.openwrt.org/releases/18.06.1/targets/armvirt/32/openwrt-18.06.1-armvirt-32-root.ext4.gz -O root.ext4.gz
[ -e root.ext4 ] || gunzip root.ext4.gz
# /etc/init.d/firewall stop
qemu-system-arm -M virt-2.9 \
-kernel zImage -no-reboot -nographic \
@xkou
xkou / a-clash-tproxy-gateway.md
Created June 24, 2023 09:21 — forked from phlinhng/a-clash-tproxy-gateway.md
Clash as transparent proxy gateway via TPROXY

Notes

  1. If your local network use public IP ranges instead of private ones, make sure to add respecive RETURN rules to iptables to prevent looping issue
  2. Set clash as DHCP's only DNS server to allow domain-based filter (shunting) rules work
  3. Use lsof -i udp:53 to check if clash's DNS module work fine, otherwise you may have to kill systemd-resolved and any other processes occupying the UDP 53 port
  4. The given scripts will NOT hangle the traffic of gateway itself since it is not recommend to do so. If you want to redirect the egress traffic of the gateway, the following material may be useful

Reference

@xkou
xkou / t.py
Created June 1, 2023 15:40
view docker image dependence
import argparse
import docker
def find_img(img_idx, id):
try:
return img_idx[id]
except KeyError:
for k, v in img_idx.items():
if k.rsplit(":", 1)[-1].startswith(id):
return v
@xkou
xkou / README.md
Created May 30, 2023 14:14 — forked from JosimarCamargo/README.md
How to setup a Postgres replication with docker and docker-compose

How to setup a Postgres replication with docker and docker-compose

How to use

To run you will need docker and docker-compose installed, and run the command docker-compose up on a folder within this file named docker-compose.yml(attached in this Gist)

How the PGAudit is enable, you will see the queries log and in which database is running which query, this is the main purpose of this Gist, along with have a database with replication working out of the box

To add user with just reading rights to access the database on slave replica

@xkou
xkou / Dockerfile
Created January 17, 2023 06:16 — forked from ciiiii/Dockerfile
Postgresql for Chinese Full-Text Search.中文全文搜索
# If you don‘t want to build it youself, you can try `docker pull killercai/postgres`.
FROM healthcheck/postgres:latest
# China debian mirror
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install -y wget git build-essential libpq-dev python-dev postgresql-server-dev-all
# SCWS (Simple Chinese Word Segmentation library)
RUN cd /tmp && wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.1.tar.bz2 | tar xjf - && cd scws-1.2.1 && ./configure && make install
# zhpaser (postgres plugin)
@xkou
xkou / stringToReaderCloser.go
Created June 9, 2022 02:20 — forked from crgimenes/stringToReaderCloser.go
string to io.ReadCloser
package main
import (
"bytes"
"fmt"
"io"
"os"
"strings"
)
# https://wiki.ubuntu.com/ARM64/QEMU
# Install QEMU and the EFI image for QEMU:
$ sudo apt-get install qemu-system-arm qemu-efi
# Now you'll need to create pflash volumes for UEFI. Two volumes are required, one static one for the UEFI firmware, and another dynamic one to store variables. Both need to be exactly 64M in size.
$ dd if=/dev/zero of=flash0.img bs=1M count=64
$ dd if=/usr/share/qemu-efi/QEMU_EFI.fd of=flash0.img conv=notrunc
$ dd if=/dev/zero of=flash1.img bs=1M count=64
# Now you should be able to boot/ into a -arm64-uefi1.img type cloud image.

PostgreSQL on Linux 最佳部署手册 - 珍藏级

作者

digoal

日期

2016-11-21

标签

@xkou
xkou / build.sh
Created September 21, 2018 02:17 — forked from jonah-williams/build.sh
Command line iOS project builds and over-the-air distribution
#!/bin/bash
# https://gist.github.com/949831
# http://blog.carbonfive.com/2011/05/04/automated-ad-hoc-builds-using-xcode-4/
# command line OTA distribution references and examples
# http://nachbaur.com/blog/how-to-automate-your-iphone-app-builds-with-hudson
# http://nachbaur.com/blog/building-ios-apps-for-over-the-air-adhoc-distribution
# http://blog.octo.com/en/automating-over-the-air-deployment-for-iphone/
# http://www.neat.io/posts/2010/10/27/automated-ota-ios-app-distribution.html