Skip to content

Instantly share code, notes, and snippets.

@glw119
glw119 / 03-edgerouter-backup.sh
Created January 28, 2024 11:58
Home Network Configuration
#!/bin/bash
source /config/user-data/edgerouter-backup.conf
# ref https://github.com/psitem/edgerouter-backup
# This script runs during the commit
# Pull commit info
COMMIT_VIA=${COMMIT_VIA:-other}
COMMIT_CMT=${COMMIT_COMMENT:-$DEFAULT_COMMIT_MESSAGE}
firewall {
ipv6-name dmz-lan-6 {
default-action drop
enable-default-log
rule 100 {
action accept
log enable
protocol ipv6-icmp
}
rule 1 {
@glw119
glw119 / lvm-cache-debian.md
Created July 26, 2023 14:09 — forked from ntn888/lvm-cache-debian.md
Instructions to create an LVM cache for root in Debian

LVM cache in Debian

From the man-pages: "The cache logical volume type uses a small and fast LV to improve the performance of a large and slow LV. It does this by storing the frequently used blocks on the faster LV. LVM refers to the small fast LV as a cache pool LV. The large slow LV is called the origin LV. Due to requirements from dm-cache (the kernel driver), LVM further splits the cache pool LV into two devices - the cache data LV and cache metadata LV. The cache data LV is where copies of data blocks are kept from the origin LV to increase speed. The cache metadata LV holds the accounting information that specifies where data blocks are stored (e.g. on the origin LV or on the cache data LV). Users should be familiar with these LVs if they wish to create the best and most robust cached logical volumes. All of these associated LVs must be in the same VG."

Assuming LVM is already setup in HDD (e.g. from anaconda) and SSD is untouched.

Create a physical

package main
import (
"bytes"
"log"
"os"
"strconv"
"github.com/gin-gonic/gin"
"golang.org/x/crypto/ssh"
@glw119
glw119 / Program.cs
Created December 2, 2021 14:34
中兴F452超级密码
static void Main(string[] args)
{
var sb = new StringBuilder();
var bytes = File.ReadAllBytes("db_user_cfg.xml");
int nextOff = 60;
int pos = 60;
while (nextOff > 0)
{
pos = nextOff;
var data = new byte[4];
@glw119
glw119 / keybase.md
Created December 29, 2020 05:51
keybase.md

Keybase proof

I hereby claim:

  • I am glw119 on github.
  • I am glw119 (https://keybase.io/glw119) on keybase.
  • I have a public key ASBo_I6tEvxgMx7YhBlABFeAnppBiOJcLbLvQWxI6ln43go

To claim this, I am signing this object:

@glw119
glw119 / elk_clean.sh
Created September 4, 2020 03:08
es数据清理
#!/bin/bash
ip=10.17.65.122
###################################
#删除早于1月前的ES集群的索引
###################################
function delete_indices() {
comp_date=`date -d "1 month ago" +"%Y-%m-%d"`
date1="$1 00:00:00"
date2="$comp_date 00:00:00"
@glw119
glw119 / README.txt
Created April 24, 2020 05:07 — forked from mariotaku/README.txt
Twitter reverse proxy configuration for Nginx
Settings on Twidere:
API URL Format: https://your-host/[DOMAIN.]twitter.com/
Uncheck "Same OAuth signing URL"
Uncheck "No verion suffix"
Password login recommended.
@glw119
glw119 / gist:9274a1ee41226d1f618893b30e56ff81
Created December 26, 2019 08:22 — forked from deltheil/gist:6037656
VLC for iOS: upload via WiFi
curl -# -F file=@"foo.mov" http://192.168.0.38:8888/upload.json >/dev/null
@glw119
glw119 / updateNasDNS.py
Last active July 30, 2022 06:04
Update Nas DNS IPv6
#!/bin/python
import digitalocean
import sys
import logging
import logging.handlers
TOKEN = "token"
DOMAIN = "example.com"
LOG_FILENAME='/home/liangwu/updateNasDNS.log'