Skip to content

Instantly share code, notes, and snippets.

View theTonyHo's full-sized avatar

Tony Ho theTonyHo

View GitHub Profile
@theTonyHo
theTonyHo / custom.css
Last active October 8, 2019 04:20
Install custom.css to Jupyter Notebook
/* Hide relevant elements */
#header, #menubar-container, div.input, div.run_this_cell, div.prompt {
display: none;
}
/* Output to expand to 100% if div.run_this_cell is hidden */
div.output_subarea {
max-width: 100%;
}
@theTonyHo
theTonyHo / DeleteAllKernels.ipynb
Created October 8, 2019 04:25
Jupyter Delete All Kernels
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@theTonyHo
theTonyHo / Readme.md
Last active November 19, 2019 22:07
D3 Tree interactive visualisation

READ ME

@theTonyHo
theTonyHo / index.html
Last active November 20, 2019 06:00 — forked from d3noob/.block
Interactive d3.js tree diagram
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Tree Example</title>
<style>
.node {
@theTonyHo
theTonyHo / Readme.md
Last active February 11, 2020 00:58
Coordinate Reference Systems

To create a projection with custom origin, modify "natural origin" parameters i.e.

        PARAMETER["Latitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8801]],
        PARAMETER["Longitude of natural origin",0,
            ANGLEUNIT["degree",0.0174532925199433],
            ID["EPSG",8802]],
@theTonyHo
theTonyHo / autoVersion.csproj
Last active March 28, 2023 15:39
MSBuild AutoVersion using Regex
<!-- reference: https://stackoverflow.com/questions/2982559/extract-number-from-string-in-msbuild -->
<!-- source: https://gist.github.com/theTonyHo/e346d59a886433cccd990800f1cefceb -->
<Target Name="NugetPackAutoVersioning" AfterTargets="Build">
<PropertyGroup Condition=" '$(AssemblyVersion)'=='' ">
<AssemblyInfo>$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs</AssemblyInfo>
<AssemblyInfoContent>$([System.IO.File]::ReadAllText('$(AssemblyInfo)'))</AssemblyInfoContent>
<Pattern>\[assembly: AssemblyVersion\("(\d+.\d+.\d+.\d+)</Pattern>
<AssemblyVersion>$([System.Text.RegularExpressions.Regex]::Match($(AssemblyInfoContent), $(Pattern), System.Text.RegularExpressions.RegexOptions.Multiline).Groups[1].Value) (From $(AssemblyInfo))</AssemblyVersion>
</PropertyGroup>
<PropertyGroup>
# Reference: https://ss64.com/ps/syntax-elevate.html
# Place this in beginning of script
If (-NOT ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Relaunch as an elevated process:
Write-Host "Executing Script as Administrator" -ForegroundColor Green
Start-Process powershell.exe "-File",('"{0}"' -f $MyInvocation.MyCommand.Path) -Verb RunAs
exit
}
Write-Host "Executing script"