Skip to content

Instantly share code, notes, and snippets.

@tinsukE
tinsukE / freebsd_13.2_py-paperless-ngx_patch.md
Last active June 20, 2024 09:26
Patches to install py-paperless-ngx 2.7.2 on FreeBSD 13.2

Patches to install py-paperless-ngx 2.7.2 on FreeBSD 13.2, which can come in handy if you can't upgrade, yet (ex: you run TrueNAS Core).

os.sched_getaffinity.patch

numpy and joblib need to be patched to avoid an exception when calling os.getaffinity():

OverflowError: could not allocate a large enough CPU set

This might be something needed for my system only, which is a FreeBSD 13.1 machine (TrueNAS CORE) hosting a FreeBSD 13.2 jail.

py-threadpoolctl.patch

@ohmantics
ohmantics / hb-setup.sh
Last active May 21, 2024 17:46
Homebridge in an iocage jail
DATASET=/zroot/apps
# Create the jail
iocage create -n "homebridge" -r 13.1-RELEASE dhcp=1 bpf=1 vnet=1 allow_raw_sockets="1" boot="on"
# switch to Latest
iocage exec homebridge "mkdir -p /usr/local/etc/pkg/repos"
iocage exec homebridge "echo -e 'FreeBSD: { url: \"pkg+http://pkg.FreeBSD.org/\${ABI}/latest\" }' > /usr/local/etc/pkg/repos/FreeBSD.conf"
# Install Homebridge and dependencies
@Aqours
Aqours / create_swap_asuswrt.sh
Last active June 5, 2024 14:55
Creating Swap File for AsusWrt(RT-AC86U)
# @see https://www.snbforums.com/threads/add-swap-to-usb-drive-on-asus-router.46911/
# Run the command `df` to see where your USB drive is mounted.
# Should be something like /tmp/mnt/volume-label
# Of course use your volume label in the following commands.
#--------------------------------------------
# Create a swap file
#--------------------------------------------
dd if=/dev/zero of=/tmp/mnt/volume-label/myswap.swp bs=1k count=524288
mkswap /tmp/mnt/volume-label/myswap.swp
r4---sn--cxaaj5o5q5-tt16.googlevideo.com
r2---sn--u2oxu-2v16.googlevideo.com
r3---sn--q5u5bgv02-3c26.googlevideo.com
r7---sn--w5nuxa-o536.googlevideo.com
r1---sn--nx5e6n76.googlevideo.com
r2---sn--nx5e6n76.googlevideo.com
r3---sn--nx5e6n76.googlevideo.com
r4---sn--nx5e6n76.googlevideo.com
r5---sn--nx5e6n76.googlevideo.com
r6---sn--nx5e6n76.googlevideo.com
@ajmassi
ajmassi / LXCBindMount.md
Last active July 19, 2024 14:40
Create a bind mount from a Proxmox host on an unprivileged lxc container

Proxmox Assign Bind Mount To Unprivileged Container

In order for the LXC container to have full access the proxmox host directory, a subgid is set as owner of a host directory, and an ACL is used to ensure permissions.

Bind Mount dataset to LXC

Add the following line to /etc/pve/lxc/<CT_ID>.conf

mp0:/mount/point/on/host,mp=/mount/point/on/lxc

Create group on host

In the default Proxmox configuration, unpriviliged container subgids will have the prefix "10" followed by the expected 4-digit gid.

@AfroThundr3007730
AfroThundr3007730 / socks-create.sh
Created June 23, 2019 17:48
Create an on-demand SSH-based SOCKS5 proxy via systemd socket activation
#!/bin/bash
# These steps will allow the setup of an on-demand SSH proxy
# Three unit files will be created to serve this purpose:
# ssh-socks-helper.socket - The listening socket providing activation
# ssh-socks-helper.service - A systemd proxy to pass the socket fd
# ssh-socks.service - The actual SSH service providing the tunnel
cat <<'EOF' > ~/.config/systemd/user/ssh-socks-helper.socket
[Unit]
Description=Proxy Helper Socket for Bastion SOCKS5 Proxy
@hjbotha
hjbotha / free_ports.sh
Last active July 10, 2024 17:33
Free ports 80 and 443 on Synology NAS
#! /bin/bash
# NEWLY ADDED BACKUP FUNCTIONALITY IS NOT FULLY TESTED YET, USE WITH CARE, ESPECIALLY DELETION
# Developed for DSM 6 - 7.0.1. Not tested on other versions.
# Steps to install
# Save this script in one of your shares
# Edit it according to your requirements
# Backup /usr/syno/share/nginx/ as follows:
# # cd /usr/syno/share/
# # tar cvf ~/nginx.tar nginx
@wwqgtxx
wwqgtxx / client_config.sh
Last active November 13, 2019 08:24
tunnel
#!/bin/bash
that_ip=192.168.31.1
server_ip=10.10.16.27
my_ip=$(ip -f inet address show ens33| grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}/24'| grep -oE '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')
echo that_ip=$that_ip
echo server_ip=$server_ip
echo my_ip=$my_ip
@blueset
blueset / telegram-zh.scpt
Last active September 6, 2018 10:39
Telegram Swift Native load language file
-- Telegram Native Swift 汉化脚本
-- 制作:Eana Hufwe
set zh_cn to "简体中文语言文件,来自 @zh_CN 的 GitHub Repo"
set zh_tw to "正體中文化文件(台灣),尚未收录"
set zh_hk to "繁體中文化文件(香港),尚未收录"
set tlocal to "本地语言文件"
set iinput to (choose file with prompt "选择您的 Telegram Native Swift 程序。" of type {"app"} default location "Applications") as string
set tgpath to POSIX path of iinput
@mckelvin
mckelvin / chnroute_for_ipsec.py
Last active March 17, 2020 03:32
Split VPN traffic for IPSec using CHNROUTE 监听 syslog, 发现 IPSec VPN 连接建立或断开后基于CHNROUTE去修改路由表。
# coding: utf-8
#
# OS X 11 (macOS ) 之后不再支持 PPTP VPN. 但 Cisco IPSec VPN 不支持像 PPTP 的
# /etc/ppp/ip-up 和 /etc/ppp/ip-down 一样方便j的机制来更新 chnroute 路由表。
# 这个脚本尝试在 Cisco IPSec VPN 下自动处理 chnroute, 做的主要工作是监听 syslog,
# 发现 IPSec VPN 连接建立或断开后去修改路由表。
#
# NOTE: 使用前可能需要修改 CUSTOMED_ROUTE_DATA, 建议将其设为
# 排除VPN子网后的 rfc1918 定义的内网IP段
#