Skip to content

Instantly share code, notes, and snippets.

@luhaoming
luhaoming / fblink_sanitizer .user.js
Last active Nov 23, 2018
Facebook link sanitizer
View fblink_sanitizer .user.js
@luhaoming
luhaoming / remove_cygwin.cmd
Created Nov 14, 2018
remove cygwin at windows7
View remove_cygwin.cmd
## remove registry
reg delete /f HKEY_CURRENT_USER\Software\Cygwin
reg delete /f HKEY_LOCAL_MACHINE\SOFTWARE\Cygwin
## remove shortcut
del c: /s "cygwin*.lnk"
## remove files
rd /s/q c:\cygwin64
@luhaoming
luhaoming / vpnuser.sh
Created Aug 31, 2018
openvpn user management
View vpnuser.sh
vpnuser make <username>
vpnuser dele <username>
@luhaoming
luhaoming / chkssl.sh
Last active Mar 7, 2018
check ssl cert expiration
View chkssl.sh
#!/bin/bash
DAYS=30
RECIPIENT="username@email.com"
while read TARGET
do
if [ -z "$TARGET" ];then continue; fi
@luhaoming
luhaoming / dateFormat.js
Last active Jan 18, 2018
xuite javascripts
View dateFormat.js
/*
* Date Format 1.2.3
* (c) 2007-2009 Steven Levithan <stevenlevithan.com>
* MIT license
*
* Includes enhancements by Scott Trenda <scott.trenda.net>
* and Kris Kowal <cixar.com/~kris.kowal/>
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
View cpualert.vbs
'==== summary =====
' 每10分鐘測試CPU使用率, 若連續測試超過10次 則透過SMTP寄送警訊給管理者
' 如有需要, 修改以下內容
' objMessage.Subject 警訊內容
' objMessage.From 寄件人
' objMessage.To    收件人
' objMessage.TextBody 警訊內容
' 提供寄信的SMTP主機
' objMessage.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver
'==== summary =====
@luhaoming
luhaoming / 7zback.sh
Created Dec 25, 2017
full and diff backup with 7zip at linux
View 7zback.sh
#!/bin/bash
# daily backup
# last update 2017-12-25
#
function usage {
echo "$1 not set"
echo "usage: "
echo "7zback <BackToPath> <Bac
@luhaoming
luhaoming / pchome.cmd
Last active Dec 4, 2017
daily download pchome by bitsadmin
View pchome.cmd
:: @echo off
:: daily download pchome by bitsadmin
set /a dt=%date:~0,4%%date:~5,2%%date:~8,2%
set pchome=http://24h.pchome.com.tw/onsale/v3/%dt%/#!3c.htm
bitsadmin.exe /transfer "download" %pchome% d:\local\downloads\pchome.html
@luhaoming
luhaoming / withBig5.php
Created Oct 18, 2017
check the string contains big5 charactor
View withBig5.php
function withBig5($arg_strContent)
{
$blnEnglishOnly= true;
$intLoopCount = 0;
$intContentLength = strlen($arg_strContent);
while ($intLoopCount < $intContentLength)
{
$chrSingle = substr($arg_strContent,$intLoopCount,1);
if(ord($chrSingle) > 0x80)
{
@luhaoming
luhaoming / bootnotice.cmd
Created Oct 18, 2017
bootnotice at windows
View bootnotice.cmd
@echo off
::boot notice
:: change these setting
set uid=yourname@gmail.com
set upw=yourpass
set from=yourname@gmail.com
set to=yourname@gmail.com
set title="Boot Notice"
set emailclient="D:\tasks\sendEmail.exe"