Skip to content

Instantly share code, notes, and snippets.

Working from home

Liu Yue euyuil

  • Microsoft Corporation
  • Shanghai, China
View GitHub Profile
euyuil /
Last active Apr 10, 2019 Dynamic DNS crontab script
IPADDR=`curl -s`
euyuil /
Created Mar 24, 2019
Ubuntu 18.04: Set lock screen resolution the same as current user
cp ~/.config/monitors.xml /var/lib/gdm3/.config/
chmod 600 /var/lib/gdm3/.config/monitors.xml
chown gdm:gdm /var/lib/gdm3/.config/monitors.xml
euyuil / fixowner.bat
Created Jan 27, 2018
Windows Command Line: Fix directory ownership
View fixowner.bat
takeown /F NNNNNN /A /R /D Y
icacls NNNNNN /reset /T /C
euyuil / SetupWinRM.ps1
Created Oct 21, 2016
WinRM: Enable WinRM and create an HTTPS listener with self-signed certificate.
View SetupWinRM.ps1
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
euyuil /
Last active Mar 1, 2019
Shadowsocks: Server installation and configuration on Ubuntu 14.04.
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
euyuil /
Last active Oct 21, 2016
Gnome: Change the shortcut to move window from Alt-Drag to Super-Drag.
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
euyuil / Update-Package-Reinstall.ps1
Created Feb 15, 2015
NuGet: reinstall all the packages
View Update-Package-Reinstall.ps1
# 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
euyuil /
Created Nov 30, 2014
Git: undo last commit
# 这个还能保留上一次的更改。
git reset --soft HEAD^
# 这个不能保留上一次的更改。
git reset --hard HEAD^
euyuil / MountIso.ps1
Created Sep 16, 2014
Windows: mount ISO through PowerShell
View MountIso.ps1
Mount-DiskImage -ImagePath X:\cn_windows_server_2012_r2_with_update_x64_dvd_4048415.iso
# Note that ImagePath must be absolute path.
euyuil / AutoAttach.ps1
Last active Aug 29, 2015
Storage Spaces: automatically attach virtual disk in PowerShell
View AutoAttach.ps1
Set-VirtualDisk -FriendlyName "September Disk" -IsManualAttach 0
You can’t perform that action at this time.