Skip to content

Instantly share code, notes, and snippets.

@julianlam
julianlam / expose-directory-on-host-to-lxc-container.md
Last active May 6, 2024 06:41
Exposing a directory on the host machine to an LXC container #blog

Exposing a directory on the host machine to an LXC container

  1. Log into the container and create an empty directory, this will be the mount point
  2. Log out and stop the container.
  3. Open to your container's config file
    • For regular LXC containers: /var/lib/lxc/mycontainer/config
    • For unprivileged LXC containers: $HOME/.local/share/lxc/mycontainer/config
  4. Add a new line above the lxc.mount directive, that follows the format below. Substitute proper paths as necessary:
    • lxc.mount.entry = /path/to/folder/on/host /path/to/mount/point none bind 0 0
  • Both of these paths are relative to the host machine.
@Aqours
Aqours / create_swap_asuswrt.sh
Last active April 14, 2024 16:07
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
@preshing
preshing / build_cross_gcc
Last active April 11, 2024 02:14
A shell script to download packages for, configure, build and install a GCC cross-compiler.
#! /bin/bash
set -e
trap 'previous_command=$this_command; this_command=$BASH_COMMAND' DEBUG
trap 'echo FAILED COMMAND: $previous_command' EXIT
#-------------------------------------------------------------------------------------------
# This script will download packages for, configure, build and install a GCC cross-compiler.
# Customize the variables (INSTALL_PATH, TARGET, etc.) to your liking before running.
# If you get an error and need to resume the script from some point in the middle,
# just delete/comment the preceding lines before running it again.
@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
@lembacon
lembacon / luna_pinyin.emoji.dict.yaml
Last active November 20, 2023 16:09
Pinyin-Emoji Dictionary for Squirrel
# Rime dictionary
# encoding: utf-8
---
name: luna_pinyin.emoji
version: "2017.02.10"
sort: by_weight
use_preset_vocabulary: true
...
@lanceliao
lanceliao / dnsmasq-gfwlist.py
Last active August 18, 2023 11:26
将gfwlist转换成带ipset的dnsmasq规则,适用于OpenWrt智能上网
#!/usr/bin/env python
#coding=utf-8
#
# Generate a list of dnsmasq rules with ipset for gfwlist
#
# Copyright (C) 2014 http://www.shuyz.com
# Ref https://code.google.com/p/autoproxy-gfwlist/wiki/Rules
import urllib2
import re
@puhitaku
puhitaku / supervisor
Last active March 9, 2022 11:15
Supervisor init script for OpenWrt (procd).
#!/bin/sh /etc/rc.common
#
# AUTHOR: Takumi Sueda <puhitaku@gmail.com>
#
# Start/stop/restart supervisor in OpenWrt.
START=91
USE_PROCD=0
PROG=/usr/bin/supervisord
@leolovenet
leolovenet / install_StrongSwan.sh
Created July 6, 2016 08:50
IPSEC VPN on Centos6 with StrongSwan for iOS9
#!/bin/bash
## Main reference https://raymii.org/s/tutorials/IPSEC_vpn_with_CentOS_7.html
yum -y install epel-release
yum -y install haveged strongswan
/etc/init.d/haveged start
chkconfig haveged on
cd /etc/strongswan || exit
cat > strongswan.conf <<'EOF'
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
@bao3
bao3 / autopin.sh
Last active July 4, 2021 03:10
reaver PIN时每10分钟模拟键盘输入Ctrl+C中断,因为无线网卡运行在monitor模式大约10分钟后就性能下降,因此需要强制中断reaver。使用时 sudo ./10pin aa:bb:cc:dd:ee:ff:11(即路由器MAC) 额外的reaver指令 请在空格后使用""(双引号)中写入,例如channel 6 ,可以使用 sudo ./10pin aa:bb:cc:dd:ee:ff:11 "-c 6" 如果你要实时查看进度,可以使用 tail -f /var/log/reaer.pin.log
#!/bin/sh
reaverCMD()
{
reaver -i mon0 -b $1 -v -a -S -N -r 100:60 $2 >>/var/log/reaver.pin.log &
tmp_pid=$(ps a| grep reaver | grep -v grep | awk '{print $1}' );
echo $tmp_pid;
}
while true :
do