Skip to content

Instantly share code, notes, and snippets.

View tumtumtum's full-sized avatar

Thong Nguyen tumtumtum

View GitHub Profile
@tumtumtum
tumtumtum / gist:7be3954fa404988806d3
Last active August 29, 2015 14:07
Visual Studio 2013 bug with calling generic virtual methods after hitting a breakpoint
using System;
namespace ConsoleApplication1
{
public class Foo<T>
{
public virtual T GetBar<K>(K foo, T value)
{
return value;
}
@tumtumtum
tumtumtum / gist:01cc79996036fd4d100d
Created February 3, 2015 01:35
AutoHotKey script for OSX style cursor navigation and selection on an Apple keyboard
; AutoHotKey script for OSX style cursor navigation and selection on an Apple keyboard
#Left::Send {Home}
+#Left::Send +{Home}
!Left::Send ^{Left}
+!Left::Send +^{Left}
#Right::Send {End}
+#Right::Send +{End}
!Right::Send ^{Right}
location /image/ {
# Support 100w100h and w100h100
rewrite ^\/image\/([^\/]+)\/w(\d+)$ /image/$1/$2w;
rewrite ^\/image\/([^\/]+)\/h(\d+)$ /image/$1/$2h;
rewrite ^\/image\/([^\/]+)\/w(\d+)\/h(\d+)$ /image/$1/$2w/$3h;
rewrite ^\/image\/([^\/]+)\/([^\/]+)\/w(\d+)$ /image/$1/$2/$3w;
rewrite ^\/image\/([^\/]+)\/([^\/]+)\/h(\d+)$ /image/$1/$2/$3h;
rewrite ^\/image\/([^\/]+)\/([^\/]+)\/w(\d+)\/h(\d+)$ /image/$1/$2/$3w/$4h;
@tumtumtum
tumtumtum / gist:888b2a32867797c0bdc8
Created March 29, 2015 17:27
Flush unicast cache on Yosemite
sudo discoveryutil udnsflushcaches
@tumtumtum
tumtumtum / gist:09acc1f2385575484716
Last active November 13, 2018 17:44
Updated DeployToAzure.ps1
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
## Orignial script (https://gist.github.com/PaulStovell/5234255) customized for
## Staging-To-Production with VIP swap deployment.
##
## NOTE: the script will only do Staging+VIP swap if $OctopusAzureSlot == "Staging".
## If $OctopusAzureSlot == anything else, the script will deploy directly to that slot
## without any further swapping.
##
@tumtumtum
tumtumtum / gist:8d42da0f4cd9ca277751
Created June 30, 2015 18:58
Remove red bars from parallels icon
sudo LANG=C sed -i.bak s/Parallels_Desktop_Overlay_128/Parallels_Desktop_Overlay_000/g /Applications/Parallels\ Desktop.app/Contents/MacOS/prl_client_app
@tumtumtum
tumtumtum / gist:f67e62ba3218ed8103a9
Created July 3, 2015 14:50
Octopus Deploy to Azure Website with Staging support
Import-Module 'C:\Program Files (x86)\Microsoft SDKs\azure\PowerShell\ServiceManagement\azure\Azure.psd1'
[System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Web.Deployment")
$azureCertificatePassword = $OctopusParameters["AzureCertificatePassword"]
[byte[]]$certificatebytes = [Convert]::FromBase64String($OctopusParameters["AzureCertificate"])
$certificate = new-object System.Security.Cryptography.X509Certificates.X509Certificate2 -ArgumentList @($certificatebytes,$azureCertificatePassword)
$subscriptionId = $OctopusParameters["AzureSubscriptionId"]
$subscriptionName = $OctopusParameters["AzureSubscriptionName"];
@tumtumtum
tumtumtum / gist:4e77fdb65f9eeed908b5
Created July 3, 2015 15:37
Convert cspkg to ctp format
& "C:\Program Files\Microsoft SDKs\Azure\.NET SDK\v2.6\bin\cspack.exe" "/convertToCTPPackage:%CloudServiceName%.ccproj.cspkg;%CloudServiceName%.ccproj.cspkg.ctp"
rm -force %CloudServiceName%.ccproj.cspkg
ren %CloudServiceName%.ccproj.cspkg.ctp %CloudServiceName%.ccproj.cspkg
@tumtumtum
tumtumtum / gist:0afed0f962517f0eb02e
Created July 3, 2015 15:43
Repackage cspkg file with replacement web.config
function ZipFiles( $zipfilename, $sourcedir )
{
Add-Type -Assembly System.IO.Compression.FileSystem
Add-Type -Assembly System.IO.Compression
$archive = [System.IO.Compression.ZipFile]::Open($zipfilename, [System.IO.Compression.ZipArchiveMode]::Create);
try
{
$files = [System.IO.Directory]::GetFiles($sourceDir, "*.*", [System.IO.SearchOption]::AllDirectories)
@tumtumtum
tumtumtum / DeployToAzure.ps1
Created July 3, 2015 15:43
DeployToAzure.ps1
## --------------------------------------------------------------------------------------
##
## This script is used to control how we deploy packages to Windows Azure.
## Orignial script (https://gist.github.com/PaulStovell/5234255) customized for
## Staging-To-Production with VIP swap deployment.
##
## NOTE: the script will only do Staging+VIP swap if $OctopusAzureSlot == "Staging".
## If $OctopusAzureSlot == anything else, the script will deploy directly to that slot
## without any further swapping.
##