Skip to content

Instantly share code, notes, and snippets.

@a4099181
a4099181 / putty-settings.cmd
Created April 9, 2016 20:49
PuTTY settings export
regedit /e "%userprofile%\Desktop\putty.reg" HKEY_CURRENT_USER\Software\SimonTatham
$names = "3DBuilder", "Bing", "CandyCrushSodaSaga", "Getstarted", "OfficeHub", "SkypeApp", "Solitaire", "Twitter", "Feedback"
ForEach($name in $names)
{
Get-AppxPackage -AllUsers | Where-Object { $_.Name.Contains($name) } | Remove-AppxPackage
Get-AppxProvisionedPackage -Online | Where-Object { $_.DisplayName.Contains($name) } | Remove-AppxProvisionedPackage -Online
}
@a4099181
a4099181 / Ortho4XP.cmd
Last active December 2, 2016 19:35
One-liner to make many tiles with single command (it supports: 1. continuation - it skips those coords where destination folder exists; 2. custom configuration file per tile).
FOR /L %Y IN (48,1,55) DO FOR /L %X IN (12,1,23) DO IF NOT EXIST "zOrtho4XP_+%Y+0%X\Earth nav data" IF EXIST "zOrtho4XP_+%Y+0%X\Ortho4XP.cfg" ( "%USERPROFILE%\AppData\Local\Programs\Python\Python35\python.exe" Ortho4XP.py %Y %X "zOrtho4XP_+%Y+0%X\Ortho4XP.cfg" ) ELSE ( "%USERPROFILE%\AppData\Local\Programs\Python\Python35\python.exe" Ortho4XP.py %Y %X )

Flight sim command set

Textures processing

FOR /R .\Orthophotos %F IN (PL_15/*.jpg) DO (CD %~pF && "C:\Program Files\GIMP 2\bin\gimp-console-2.8.exe" ^
                                -i -b "(greeny \"PL_15\\%~nxF\" \"Ortho4XP_PL15_64\")" -b "(gimp-quit 0)")
Requirements:
@a4099181
a4099181 / Convert-ToPackageReference.ps1
Last active February 18, 2021 07:00
Converts packages.config into PackageReference at *.csproj project file. Requires XSLT stylesheet available as second file in the gist.
Function Convert-ToPackageReference
{
Param ( [Parameter( Mandatory, ValueFromPipeline )][String] $inputUri,
[String] $stylesheetUri = "https://gist.githubusercontent.com/a4099181/074a6c3dd524ea0d343382137492399c/raw/cdd0fb31efd70c4c0f8c86ddb314de86ab8972e8/Convert-ToPackageReference.xsl",
[String] $resultsFile = [System.IO.Path]::GetTempFileName() )
Process {
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform
$xslt.Load( $stylesheetUri )
$xslt.Transform( $inputUri, $resultsFile )
@a4099181
a4099181 / Out-AIRACCycles.ps1
Last active February 5, 2021 08:06
AIRAC dates generator - enumerates AIRAC cycles: previous, current and next.
Function Out-AIRACCycles
{
Param ( [DateTime] $currentDay = ( Get-Date )
, [DateTime] $initialDay = ( Get-Date -Year 2015 -Month 1 -Day 8 )
, $interval = 28
, $culture = [System.Globalization.CultureInfo]::GetCultureInfo("en-US") )
$offset = (New-TimeSpan -Start $initialDay -End ( Get-Date -Year ( $currentDay.Year - 1 ) -Month 1 -Day 1 ) ).Days
$offset .. ( $offset + 365 * 3 ) |
@a4099181
a4099181 / Shared-SQLLocalDB-instance.md
Created September 27, 2017 06:34
Some commands to work with shared SQLLocalDB instance.

Shared SQLLocalDB instance means that a single local instance may be accessed by any other allowed user.

sqllocaldb share <user> <name> <shared-name>

<user> - user name of the owner of the SQLLocalDB instance to share,

<name> - name of the SQLLocalDB instance to share,

@a4099181
a4099181 / dice.scad
Last active October 27, 2019 20:40
OpenSCAD: dice.
/*
* 6-sided play cube
*/
$fn = 128 ;
WIDTH = 64 ;
DOT_DEEP = 3 ;
DOT_DENSITY = .2 ;
DOT_TABLE = [
[ 2, [ 2, 3, 4, 5, 6 ] ]
@a4099181
a4099181 / Copy-ChartsIntoSaab340.ps1
Last active September 24, 2018 14:48
Copies charts into LES Saab 340A at X-Plane. Charts from 01 to 05 are departure's charts. Charts from 06 to 10 are destination's charts. Custom patterns are stored into chart_list.txt. Example chart_list.txt is attached also.
Param(
$xplane_dir = ".",
$chart_list = ( Get-ChildItem -Recurse -Path "$($xplane_dir)\Aircraft" -Filter "chart_list.txt" | Select-Object -First 1 ),
[Parameter(Mandatory=$true)]
$depICAO,
[Parameter(Mandatory=$true)]
$dstICAO,
$charts_dir = "$($env:USERPROFILE)\OneDrive\Charts"
)
@a4099181
a4099181 / ConvertPdfTo-Saab340Chart.cmd
Last active September 23, 2018 08:53
Converts PDF into PNG for use as a chart in LES Saab 340A at X-Plane. Requirements: ImageMagick and Ghostscript must be in %PATH%. Tested on Windows 10 1803 with ImageMagick 7.0.7-7 Q16 (64-bit) and Ghostscript 9.22.
FOR %I IN (*.pdf) DO magick ^
-density 300 "%I[0]" -trim -units pixelsperinch ^
-density 300 -resize "1304x1304^" -rotate "-90>" ^
-colorspace gray -background white -flatten ^
-gravity west -extent "2048x2048" %~nI.png