Skip to content

Instantly share code, notes, and snippets.

View luginbash's full-sized avatar

Luginbash luginbash

View GitHub Profile
@luginbash
luginbash / haproxy.cfg
Created March 6, 2016 13:31
haproxy tls termination with client authentication
# Please set $SRV_TLS_CERT, $SRV_TLS_CA accordingly.
global
maxconn 2048
log /dev/log local0
log /dev/log local1 notice
tune.ssl.default-dh-param 2048
ssl-default-bind-ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
ssl-default-bind-options no-tls-tickets
chroot /var/lib/haproxy
stats timeout 30s
[General]
# warning, notify, info, verbose
skip-proxy = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 0.0.0.0/8, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
loglevel = notify
# 默认 IP 和端口,不修改的话系统网络 HTTP 和 HTTPS 代理设置中就是 127.0.0.1:6152
interface = 0.0.0.0
port = 6152
@luginbash
luginbash / flags
Created May 24, 2016 02:53
gcc flags
-O3
-std=c++14
-stdlib=libc++
-lc++abi
-Wall
-Werror
-pthreads
@luginbash
luginbash / ZZZ.passwd
Last active November 23, 2016 07:55
Handling SNMP traps from another server
cfSecret=
cfLogin=
@luginbash
luginbash / CTF_INST.md
Last active September 21, 2019 11:41
Installation of CTF MEG Client Software

CTF MEG Software Installation Guide

The CTF MEG software is a collection of tools to collect/manipulate/analyse MEG data. If you know well about the history of transitioning from 32bit Linux to 64bit, then you'll be fine without this guide. In this guide there will be some nasty hacks that works around package management situations, and therefore can be potentially harmful to the extent of system secruity and stablity. Though I am adding some tips about how to keep it as safe and sound as possible as my power allows, but consider you've been warned.

Installation of CTF MEG software cna be divided into two parts, enabling 32bit executables, and force installation some out-dated and risky libraries.

Getting Started

You need i386 version libc or glibc depends on the availabity on your platform, e.g. on Ubuntu 16.04 LTS:

@luginbash
luginbash / cloud-config-salt-master.yaml
Last active March 23, 2024 04:10
cloud config script
#cloud-config
timezone: UTC
locale: en_US.UTF-8
apt:
preserve_sources_list: true
sources:
docker-ce.list:
source: "deb [signed-by=$KEY_FILE] https://download.docker.com/linux/debian $RELEASE stable"
keyid: "7EA0A9C3F273FCD8"
@luginbash
luginbash / nsrun.sh
Last active January 10, 2019 07:12
create a pair of veth for use with netns
#!/bin/bash
netns0="{$1}"
addr0="{$2}"
ip0() { ip -n $netns0 "$@"; }
n0() { ip netns exec $netns0 "$@"; }
waitiface() { bash -c "while [[ \$(< \"/sys/class/net/$1/operstate\") != up ]]; do read -t .1 -N 0 || true; done;"; }
ip netns del $netns0 2>/dev/null || true
ip link del vin-"$netns0"
@luginbash
luginbash / docker-compose.yml
Last active October 10, 2019 10:10
Dockerized EFK with Fluentbit
version: '3.2'
services:
fluentbit:
image: fluent/fluent-bit:latest
links:
- "elasticsearch"
ports:
- "24224:24224"
@luginbash
luginbash / hfsToAPFS.sh
Created November 21, 2019 10:58
"Upgrade" a HFS drive to APFS
#!/bin/bash
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
VOL_NAME="Macintosh HD 10142-190404"
diskutil apfs addVolume disk3 apfs Preboot -role B
VOL_UUID=$(diskutil info disk3s1 | grep "Volume UUID"|awk '{print $(NF)}')
mkdir /Volumes/Preboot/${VOL_UUID}
diskutil mount disk1s2
SRC_UUID=$(diskutil info disk1s1 | grep "Volume UUID"|awk '{print $(NF)}')
sudo rsync -xrlptgoEvHS --progress --delete /Volumes/Preboot\ 1/${SRC_UUID}/ /Volumes/Preboot/${VOL_UUID}
#!/bin/bash
sudo ipa-server-install -U \
-n ${IPA_DOMAIN,,} \
-r ${IPA_DOMAIN^^} \
-a ${IPA_ADMIN_PASS} \
-p ${IPA_DM_PASS} \
--ca-subject="${IPA_COMMON_NAME}" \
--setup-dns \
--no-forwarders --auto-reverse --allow-zone-overlap \
--pki-config-override=/etc/ipa/override.ini \