Skip to content

Instantly share code, notes, and snippets.

@luhaoming
luhaoming / rm_container.cmd
Created October 18, 2017 01:48
remove all container in windows docker
for /f %i in ('@docker ps -a -q') do docker rm %i
@luhaoming
luhaoming / bootnotice.cmd
Created October 18, 2017 01:51
bootnotice at windows
@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"
@luhaoming
luhaoming / withBig5.php
Created October 18, 2017 03:17
check the string contains big5 charactor
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 / pchome.cmd
Last active December 4, 2017 02:21
daily download pchome by bitsadmin
:: @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 / 7zback.sh
Created December 25, 2017 06:38
full and diff backup with 7zip at linux
#!/bin/bash
# daily backup
# last update 2017-12-25
#
function usage {
echo "$1 not set"
echo "usage: "
echo "7zback <BackToPath> <Bac
@luhaoming
luhaoming / cpualert.vbs
Created January 18, 2018 01:48
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 / rm_container.cmd
Last active January 18, 2018 01:56
measure windows commnad execution time
for /f %i in ('@docker ps -a -q') do docker rm %i
@luhaoming
luhaoming / chkssl.sh
Last active March 7, 2018 02:52
check ssl cert expiration
#!/bin/bash
DAYS=30
RECIPIENT="username@email.com"
while read TARGET
do
if [ -z "$TARGET" ];then continue; fi
@luhaoming
luhaoming / vpnuser.sh
Created August 31, 2018 05:32
openvpn user management
vpnuser make <username>
vpnuser dele <username>
@luhaoming
luhaoming / remove_cygwin.cmd
Created November 14, 2018 04:25
remove cygwin at windows7
## 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