Skip to content

Instantly share code, notes, and snippets.

View tobyqin's full-sized avatar
☁️
Enter the cloud.

Toby Qin tobyqin

☁️
Enter the cloud.
View GitHub Profile
@tobyqin
tobyqin / .gitconfig
Created January 7, 2017 08:07
Personal git config
[user]
name = Toby Qin
email = toby.qin@live.com
[alias]
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(bold magenta)%d%Creset %s %Cgreen(%cr)%C(bold cyan)<%an>%Creset' --abbrev-commit
l = log --pretty=format:"%C(yellow)%h\\ %ad%Cred%d\\ %Creset%s%C(cyan)\\ [%cn]" --decorate --date=short -20
ci = commit --verbose
ca = commit -a --verbose
cm = commit -m
using System;
using System.Collections.Generic;
namespace QuickSortTest
{
internal class QuickSortTest
{
/// <summary>
/// Quick sort algorithm implement
/// </summary>
@echo off
set "targetDir=%~dp0..\"
set nuget=%~dp0..\Tools\@Executable\nuget.exe
echo =========================================
echo Restore Nuget packages for all solutions.
echo.
echo In Path: %targetDir%
echo By Tool: %nuget%
echo =========================================
echo.
@echo off
set "targetDir=%~dp0..\"
set nuget=%~dp0..\Tools\@Executable\nuget.exe
echo =========================================
echo Restore Nuget packages for all solutions.
echo.
echo In Path: %targetDir%
echo By Tool: %nuget%
echo =========================================
echo.
Function Get-DiskInfo
{
Param(
$ComputerName = $env:COMPUTERNAME,
[Switch]$PassThru
)
Function Get-ColorSplat
{
# Create color Splats
#Add TimeStamp
$thedate = Get-Date -format "yyyy-MM-dd"
$logfile = "OpenWebPage" + "$thedate" + ".txt"
$thefiledate = Get-Date -format "yyyy-MM-dd HH:mm:ss"
Add-Content $logfile "`nTime Started(yyyyMMddHHmm) $thefiledate "
$urlsplit = "http://weburl:8629/path".Split(':')
$portsplit = ":8629/path"
$urlport = $urlsplit[0] + ":" + $urlsplit[1] + $portsplit
$fport = $urlport + "query?value=test"
function Block-Processes ($pattern)
{
# $pattern=@("Spirit.*")
$proc = Get-Process -Name $pattern
foreach($p in $proc)
{
if($p -ne $null)
{
Stop-Process $p.Id -Force
}
:: Restore nuget packages
set nuget="%~dp0\Tools\nuget.exe"
pushd "%~dp0"
%nuget% restore MyApp.sln
popd
function Start-TheService([string]$svc)
{
$STOP = "Stopped"
$RUN = "Running"
"Starting $svc..."
$s = get-service -name $svc
"Original status is : " + $s.Status
if($s.Status -eq $STOP)
function Get-LogDir($env)
{
$dir = $globalConf.LogDir
New-Item -Path $dir -ItemType "Directory" -Force | Out-Null
return $dir
}
function Init-LogFile($env, $stepName)
{
$logDir = Get-LogDir $env