Skip to content

Instantly share code, notes, and snippets.

'
' File Description : VBScript Windows Fonts Installer
'
' Copyright (c) 2012-2013 WangYe. All rights reserved.
'
' Author: WangYe
' Site: http://wangye.org
' This code is distributed under the BSD license
'
' For more information please visit
Option Explicit
'
' Copyright (c) 2012-2013 WangYe. All rights reserved.
'
' Author: WangYe
' Site: http://wangye.org
' This code is distributed under the BSD license
'
' For more information please visit
@wangye
wangye / ComputeAge.vbs
Created February 26, 2012 12:04
Compute Age in many ways
Option Explicit
' ***************************************************
' *
' * Description: 计算年龄
' * Author: wangye <pcn88 at hotmail dot com>
' * Website: http://wangye.org
' *
' * Paramters:
' * ByVal datetime 出生日期或者要比较的日期1
@wangye
wangye / backup-example.sh
Created March 5, 2012 04:53
Bash shell for backup WordPress and MySQL database
#!/bin/bash
# Author: wangye
# For more information please visit:
# http://wangye.org/
# 请在使用本脚本前做好测试工作,脚本功能仅供参考,
# 对于可能的潜在问题造成损失,本人不承担责任。
MYSQL_USERNAME="mysql-username"
MYSQL_PASSWORD="mysql-password"
@wangye
wangye / ReflectionHash.cs
Created March 7, 2012 02:38
C# Reflection MD5/SHA1 Hash
//
// Description: C# Reflection MD5/SHA1 Hash
// Author: wangye <pcn88 at hotmail dot com>
// Website: http://wangye.org
// For more information please visit:
// http://wangye.org/blog/archives/134/
//
using System;
using System.Text;
using System.Security.Cryptography;
@wangye
wangye / PathFunc.vbs
Created March 7, 2012 02:50
VBScript Path Functions
'
' Author: wangye
' For more information please visit
' http://wangye.org/blog/archives/250/
'
Function PathRemoveFileSpec1(strFileName)
' 将类Unix路径 / 替换为 \
strFileName = Replace(strFileName, "/", "\")
Dim iPos
@wangye
wangye / GetSysInstDate.vbs
Created March 7, 2012 02:46
VBScript Get Windows OS installation date
Option Explicit
Const HKEY_LOCAL_MACHINE = &H80000002
Const REG_DWORD = 4
Function VBMain()
Dim strComputer, strKeyPath, lngValue, Registry
strComputer = "."
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"
@wangye
wangye / cObjectManager.class.vbs
Created March 7, 2012 02:45
VBScript Object Manager
'
' Author : wangye
' For more information please visit:
' http://wangye.org/blog/archives/267/
'
Class cObjectManager
Public IsPersist
Private objHost
Private objDict
@wangye
wangye / CheckFileName.vbs
Created March 7, 2012 02:41
VBScript Check File Name
' Check File Name
Function IsAcceptableFileName(fileName)
Set objRegExp = New RegExp
objRegExp.IgnoreCase = True
objRegExp.Global = False
objRegExp.Pattern = _
"^(?!^(PRN|AUX|CLOCK\$|CONFIG\$|" & _
"NUL|CON|COM\d|LPT\d|\..*)" & _
"(\..+)?$)[^\x00-\x1f\\?*:\"";|/]+$"
IsAcceptableFileName = objRegExp.Test(fileName)
@wangye
wangye / b24.c
Created March 7, 2012 02:29
Base24 encode and decode
/*
Author: wangye
http://wangye.org/
*/
static const char sel[] = {
'B','C','D','F','G',
'H','J','K','M','P',
'Q','R','T','V','W',
'X','Y','2','3','4',
'6','7','8','9', '\0'};