Skip to content

Instantly share code, notes, and snippets.

@a4099181
a4099181 / Dockerfile
Created Nov 7, 2020
OpenSSL Dockerfile
View 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 Aug 5, 2019
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).
View dirstat.ps1
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 May 22, 2019
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…
View Send-ChangedDynamicIP.ps1
@{
RegistryKey = `
Get-ItemProperty -Path HKCU:\Software\seb!\Send-ChangedDynamicIP;
Current= `
( Invoke-WebRequest -Uri https://api.ipify.org?format=json -UseBasicParsing ).Content `
| ConvertFrom-Json `
| select -ExpandProperty ip;
Mac = `
Get-WmiObject win32_networkadapterconfiguration `
| ? DefaultIPGateway `
@a4099181
a4099181 / ConvertPdfTo-Saab340Chart.cmd
Last active Sep 23, 2018
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.
View ConvertPdfTo-Saab340Chart.cmd
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 Sep 24, 2018
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.
View Copy-ChartsIntoSaab340.ps1
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 Oct 27, 2019
OpenSCAD: dice.
View dice.scad
/*
* 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 Sep 27, 2017
Some commands to work with shared SQLLocalDB instance.
View Shared-SQLLocalDB-instance.md

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 Feb 5, 2021
AIRAC dates generator - enumerates AIRAC cycles: previous, current and next.
View Out-AIRACCycles.ps1
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 Feb 18, 2021
Converts packages.config into PackageReference at *.csproj project file. Requires XSLT stylesheet available as second file in the gist.
View Convert-ToPackageReference.ps1
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 )
View FlightSim.md

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: