Skip to content

Instantly share code, notes, and snippets.

View vivainio's full-sized avatar

Ville Vainio vivainio

View GitHub Profile
@vivainio
vivainio / leoAtFile-compact-sentinel-demo.py
Created August 14, 2026 18:24
Leo compact thin-file sentinel syntax demo: full leoAtFile.py using optional gnx and relative outline depth
# @+leo-ver=6-thin-relative-demo
# @0 [ekr.20150323150718.1] @file leoAtFile.py
"""Classes to read and write @file nodes."""
# @+<< leoAtFile imports & annotations >>
# @+ << leoAtFile imports & annotations >>
from __future__ import annotations
from collections.abc import Callable
import difflib
import io
@vivainio
vivainio / profile.ps1
Last active February 3, 2025 07:57
Powershell function to run tasks.py in current or any parent dirertory. Add this to your powershell profile ($PROFILE)
function pt {
$currentDir = Get-Location
$parentDir = $currentDir
while ($parentDir -ne [System.IO.Path]::GetPathRoot($parentDir)) {
$tasksPyPath = Join-Path -Path $parentDir -ChildPath "tasks.py"
$venvPath = Join-Path -Path $parentDir -ChildPath ".venv"
if (Test-Path $tasksPyPath) {
Set-Location $parentDir
emphasis { font-style: italic; }
strong { font-weight: bold; }
header { color: rgba(0, 0, 128, 1); }
comment { color: rgba(96, 139, 78, 1); }
constant.language { color: rgba(86, 156, 214, 1); }
constant.numeric { color: rgba(181, 206, 168, 1); }
constant.regexp { color: rgba(100, 102, 149, 1); }
constant.rgb-value { color: rgba(212, 212, 212, 1); }
entity.name.tag { color: rgba(86, 156, 214, 1); }
entity.name.function { color: rgba(212, 212, 212, 1); }

Debugging c# dump with windbg

Applies to .NET 4.7 applications.

Right click on dmp, "open with" -> windbg.

Run command:

.cordll -ve -u -l
# in case of error: pull access denied for xxxx.dkr.ecr.eu-west-1.amazonaws.com/my-app, repository does not exist or may require 'docker login': denied: User: arn:aws:sts::xxxxxxxxx:xassumed-role/my-ci-cd-pipeline-codebuild-builder-role/AWSCodeBuild-xxxxxxx is not authorized to perform: ecr:BatchGetImage on resource: arn:aws:ecr:eu-west-1:xxxxxxxxxxxxx:repository/my-app
# see also https://docs.aws.amazon.com/codebuild/latest/userguide/sample-ecr.html
AWSTemplateFormatVersion: 2010-09-09
Resources:
EcrRepo:
Type: AWS::ECR::Repository
Properties:
RepositoryName: my-application-repo
# this policy is needed to allow pushing & pulling of this image from codebuild
rem "Startup" is the aspnet web app root, with Web.config, bin/ etc. /myaps in the website root
C:\Windows\System32\inetsrv\appcmd.exe set app MyWebSite/myapp -[path='/'].physicalPath:Src\MyProject\Backend\Startup
@vivainio
vivainio / gist:5261207
Created March 28, 2013 06:51
sublime text theme
/*
This *comment* is parsed to extract constants (macros) defined below.
constants:
@solarized-base03 = #272822
@solarized-base02 = #073642
@solarized-base01 = #586e75
@solarized-base00 = #657b83
export type ResultOrErr<T> =
| {
err: undefined;
data: T;
}
| {
err: Error;
data: undefined;
};
C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:10245
return !!(module.flags & 1024);
^
TypeError: Cannot read property 'flags' of undefined
at Object.isGlobalScopeAugmentation (C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:10245:26)
at C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:84773:96
at Object.some (C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:587:25)
at containsGlobalScopeAugmentation (C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:84773:23)
at isFileAffectingGlobalScope (C:\r\1\Src\Edge\Personal\frontend\node_modules\typescript\lib\tsc.js:84776:20)