Skip to content

Instantly share code, notes, and snippets.

View lanceliao's full-sized avatar

Lance Liao lanceliao

View GitHub Profile
@lanceliao
lanceliao / wg-client1.conf
Last active November 15, 2024 14:20
Sample WireGuard configuration files
[Interface]
Address = 10.200.200.3/32
PrivateKey = [Client's private key]
DNS = 8.8.8.8
[Peer]
PublicKey = [Server's public key]
PresharedKey = [Pre-shared key, same for server and client]
Endpoint = [Server Addr:Server Port]
AllowedIPs = 0.0.0.0/0
@lanceliao
lanceliao / 0ssd_smart.service
Last active October 4, 2015 04:53
record SSD smart status to a file on startup and suspend
[Unit]
Description=Record SSD smart status
Before=suspend.target
[Service]
Type=oneshot
ExecStart=/opt/scripts/ssd-monitor.sh
RemainAfterExit=no
[Install]
@lanceliao
lanceliao / extend_screen.sh
Created September 27, 2015 03:01
set different scaling on an extend screen, this script is expected to solve the scaling problem on HiDPI screens of Linux
#!/bin/bash
#
# extend second screen with different scaling
#
# Copyright (C) 2015 http://www.shuyz.com
# REF: 1. http://blog.jamiek.it/2015/04/manually-fixing-multiple-screens-with.html
# 2. https://bbs.archlinux.org/viewtopic.php?id=118999
# 3. http://unix.stackexchange.com/questions/101809/how-can-i-automatically-update-my-monitor-layout-in-xfce
@lanceliao
lanceliao / gist:bdb6bc4cf38e3bd0097c
Last active September 20, 2015 05:16 — forked from anonymous/gist:4466934
.conkyrc
background yes
use_xft yes
xftfont 123:size=6
xftalpha 0.1
update_interval 2
total_run_times 0
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
  1. 开启ipv4转发
vi /etc/sysctl.conf
# 将net.ipv4.ip_forward=0更改为net.ipv4.ip_forward=1
sysctl -p
  1. 安装dnsmasq 和pdnsd解决dns污染

DNS的解析方案为 resolve.conf ==> dnsmasq ==> pdnsd

@lanceliao
lanceliao / dnsmasq-gfwlist.py
Last active June 19, 2024 00:35
将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
@lanceliao
lanceliao / openwrt-usb-serial.md
Created August 19, 2014 11:48
OpenWrt USB转串口模块的调试

###安装

opkg install kmod-usb-serial kmod-usb-serial-pl2303

安装完成之后需要手动载入内核模块:

insmod usbserial
insmod pl2303
@lanceliao
lanceliao / luci-lighttpd-openwrt.md
Last active February 26, 2020 15:43
Configure LUCI on lighttpd

###Install

opkg install lighttpd lighttpd-mod-cgi

###Configgure

修改/etc/lighttpd/lighttpd.conf

  1. static-file.exclude-extensions = (".php", ".pl", ".fcgi")改成static-file.exclude-extensions = (".php", ".pl", ".fcgi", ".lua")
@lanceliao
lanceliao / samba-openwrt.md
Last active May 12, 2022 18:28
Samba on OpenWrt 配置

##安装

opkg update && opkg install samba luci-app-samba

##配置

匿名登录

#/etc/config/samba
config sambashare
@lanceliao
lanceliao / raspberry-chkwifi.sh
Created August 14, 2014 09:20
Raspberry Pi WIFI protect script - auto reconnect when AP is powered on after a powered off. call this script in crontab.
#!/bin/bash
export PATH=$PATH:/sbin
# Auto reconnect to specified WIFI access point if there is no internect connection
# Author: Lance
# Website: http://www.shuyz.com
# Last updated: 2013/05/25
#your WIFI SSID here to be auto connect
SSID=ShuYZ