Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Liu Yue euyuil

  • Microsoft Corporation
  • Shanghai, China
View GitHub Profile
@euyuil
euyuil / gandi-ddns.sh
Last active Apr 10, 2019
Gandi.net: Dynamic DNS crontab script
View gandi-ddns.sh
#!/bin/bash
# https://doc.livedns.gandi.net/
# https://www.ipify.org/
APIKEY='YourKeyGoesHere'
DOMAIN='example.com'
NAME='@'
IPADDR=`curl -s https://api.ipify.org/`
@euyuil
euyuil / update-resolution.sh
Created Mar 24, 2019
Ubuntu 18.04: Set lock screen resolution the same as current user
View update-resolution.sh
#!/bin/bash
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
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
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
euyuil / install-and-configure-shadowsocks-server.sh
Last active Mar 1, 2019
Shadowsocks: Server installation and configuration on Ubuntu 14.04.
View install-and-configure-shadowsocks-server.sh
#!/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
@euyuil
euyuil / disable-alt-drag.sh
Last active Oct 21, 2016
Gnome: Change the shortcut to move window from Alt-Drag to Super-Drag.
View disable-alt-drag.sh
gsettings set org.gnome.desktop.wm.preferences mouse-button-modifier "<Super>"
@euyuil
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
euyuil / undo-last-commit.sh
Created Nov 30, 2014
Git: undo last commit
View undo-last-commit.sh
# 这个还能保留上一次的更改。
git reset --soft HEAD^
# 这个不能保留上一次的更改。
git reset --hard HEAD^
@euyuil
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
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.