Skip to content

Instantly share code, notes, and snippets.

@a4099181
a4099181 / Dockerfile
Created November 7, 2020 07:54
OpenSSL Dockerfile
FROM alpine
VOLUME [ "/demoCA" ]
RUN apk update && \
apk add --no-cache openssl git perl && \
rm -rf /var/cache/apk/*
RUN ln -s /etc/ssl/misc/CA.pl /usr/bin/ca
@a4099181
a4099181 / dirstat.ps1
Created August 5, 2019 09:36
Powershell script to calculate directory size. Lists all directories in a current directory. Calculates and prints a size for each of them (dirstat, folder statistics).
Get-ChildItem -Directory |
Select-Object `
@{ N="Directory"; E={ $_.Name } }, `
@{ N="Size"; E={ (Get-ChildItem -Recurse -File -Path $_.FullName | Measure-Object -Property Length -Sum).Sum } } |
Sort-Object -Property Size -Descending
@a4099181
a4099181 / Send-ChangedDynamicIP.ps1
Last active November 27, 2022 17:18
Retrieves the current IP address. Stores the current IP address in the Windows registry to track changes. Notifies you of changes via email. Generates a link to wake up the computer via the Internet (wake on Lan, wake on WAN). Requires the creation of an registry key: 'HKCU\Software\seb!\Send-ChangedDynamicIP' with a property named 'Known'. Crea…
@{
RegistryKey = `
Get-ItemProperty -Path HKCU:\Software\seb!\Send-ChangedDynamicIP;
Current= `
( Invoke-WebRequest -Uri https://api.ipify.org?format=json -UseBasicParsing ).Content `
| ConvertFrom-Json `
| Select-Object -ExpandProperty ip;
Mac = `
Get-WmiObject win32_networkadapterconfiguration `
| Where-Object DefaultIPGateway `
@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
@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 / 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 / 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 / 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 / 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 )

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: