Skip to content

Instantly share code, notes, and snippets.

View vincascm's full-sized avatar
☘️
...

vinoca vincascm

☘️
...
View GitHub Profile
@vincascm
vincascm / phantun_client_watchdog.sh
Created May 25, 2024 03:23
A watchdog for running the Phantun client and WireGuard in OpenWrt
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
#
WAIT_DURATION=300
. /lib/functions.sh
check_peer_activity() {
local cfg=$1
@vincascm
vincascm / triple_des.rs
Last active August 20, 2024 19:13
triple des(3des) ecb pkcs5 padding encrypt/decrypt function for rust, use openssl crypto library.
//! triple des(3des) ecb pkcs5 padding encrypt/decrypt function for rust, use openssl crypto
//! library.
//! refer to <http://blog.csdn.net/lyjinger/article/details/1722570>
//! coded by vinoca.
//! 2017.11.24
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
extern crate libc;
#!/bin/sh
# 版本一:
# code by jm modified by youxi01 2006-12-3 CMD@XP
# 出处:http://www.cn-dos.net/forum/viewthread.php?tid=25369
#title 读心术P处理版
#:begin
@vincascm
vincascm / wol.lua
Created August 11, 2015 07:58
lua script for wake on lan(wol)
#!/usr/bin/lua
if #arg ~= 2 then
print("Usage: wol.lua <broadcast> <mac>\n")
os.exit()
end
local mac = ''
for w in string.gmatch(arg[2], "[0-9A-Za-z][0-9A-Za-z]") do
mac = mac .. string.char(tonumber(w, 16))
@vincascm
vincascm / idcard_check.lua
Last active August 29, 2015 14:02
18位国内身份证号码验证
function check (id)
local error_code = { "The length of ID card number is not 18.", "ID card number is invalid.",
"birthday is invalid.", "check code is invalid." }
local month_day = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }
local weight = { 7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2 }
local check_code = { "1", "0", "X", "9", "8", "7", "6", "5", "4", "3", "2" }
local year = tonumber(string.sub(id, 7, 10))
local month = tonumber(string.sub(id, 11, 12))
local day = tonumber(string.sub(id, 13, 14))
@vincascm
vincascm / ddns.sh
Created August 26, 2012 10:35
dnspod ddns client for Openwrt
#!/bin/sh
# sddns, a dnspod ddns client for OpenWrt
# Written by vinoca, June 2012
# Distributed under the MIT License
#
# more visit www.vinoca.org
VERSION=0.0.4