This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Copied from: | |
// http://www.minddriven.de/index.php/technology/dot-net/c-sharp/efficient-expression-values | |
public static class Guard | |
{ | |
public static void AssertNotNull<T>(Expression<Func<T>> selector) | |
{ | |
var memberSelector = (MemberExpression)selector.Body; | |
var constantSelector = (ConstantExpression)memberSelector.Expression; | |
var value = ((FieldInfo)memberSelector.Member).GetValue(constantSelector.Value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using Microsoft.WindowsAzure.Storage; | |
using Microsoft.WindowsAzure.Storage.Table; | |
/// <summary> | |
/// The table entities that extend from this type will have rich support in property types. | |
/// </summary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-VirtualDisk -FriendlyName "September Disk" -IsManualAttach 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mount-DiskImage -ImagePath X:\cn_windows_server_2012_r2_with_update_x64_dvd_4048415.iso | |
# Note that ImagePath must be absolute path. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 这个还能保留上一次的更改。 | |
git reset --soft HEAD^ | |
# 这个不能保留上一次的更改。 | |
git reset --hard HEAD^ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# If you want to reinstall the packages for a project | |
Update-Package -Reinstall -ProjectName Your.Project.Name | |
# If you want to reinstall the packages for a solution | |
Update-Package -Reinstall |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
sudo apt-get -y update | |
sudo apt-get -y upgrade | |
sudo apt-get install -y python-gevent python-pip python-m2crypto supervisor | |
sudo pip install shadowsocks | |
sudo mkdir -p touch /etc/shadowsocks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Param ($DnsName) | |
$Cert = New-SelfSignedCertificate -CertStoreLocation Cert:\LocalMachine\My -DnsName $DnsName -Verbose | |
$Password = ConvertTo-SecureString -String $DnsName -Force -AsPlainText -Verbose | |
Export-Certificate -Cert $Cert -FilePath .\$DnsName.cer -Verbose | |
Export-PfxCertificate -Cert $Cert -FilePath .\$DnsName.pfx -Password $Password -Verbose | |
$CertThumbprint = $Cert.Thumbprint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
takeown /F NNNNNN /A /R /D Y /SKIPSL | |
icacls NNNNNN /reset /T /C /L |