https://stackoverflow.com/questions/32960857/how-to-convert-arbitrary-simple-json-to-csv-using-jq
jq -r '
(map(keys) | add | unique) as $cols
| map(. as $row | $cols | map($row[.])) as $rows| # lessf: `less +F` for multiple files, ala `tail -f` | |
| # | |
| # Usage: | |
| # lessf file1.log file2.log ... | |
| # | |
| # - should work on dash, bash, and zsh; | |
| # - works on macOS and the Linuxes I've tested it on; | |
| # - requires the minimal tools that seem to be available nearly everywhere (`awk`, `mktemp`), and of course `less` | |
| # - you may want `unbuffer` or `stdbuf` to avoid the 4kb of buffering (i.e. no output until enough loglines have been added.) | |
| # |
https://stackoverflow.com/questions/32960857/how-to-convert-arbitrary-simple-json-to-csv-using-jq
jq -r '
(map(keys) | add | unique) as $cols
| map(. as $row | $cols | map($row[.])) as $rows| #!/bin/sh | |
| # Prepares freshly installed WSL | |
| # Written for: | |
| # WLS2, Ubuntu 22.04 | |
| sudo apt update | |
| sudo apt install wslu | |
| # TODO: |
| using namespace System.Management.Automation | |
| Register-ArgumentCompleter -CommandName ssh,scp,sftp -Native -ScriptBlock { | |
| param($wordToComplete, $commandAst, $cursorPosition) | |
| $knownHosts = Get-Content ${Env:HOMEPATH}\.ssh\known_hosts ` | |
| | ForEach-Object { ([string]$_).Split(' ')[0] } ` | |
| | ForEach-Object { $_.Split(',') } ` | |
| | Sort-Object -Unique | |
| # For now just assume it's a hostname. |
| from pprint import pformat | |
| from pygments import highlight | |
| from pygments.formatters.terminal256 import Terminal256Formatter | |
| from pygments.lexers.python import PythonLexer | |
| def pprint_color(obj): | |
| print(highlight(pformat(obj), PythonLexer(), Terminal256Formatter())) |
If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).
Shift + Enter run selected cell or cells - if no cells below, insert a code cell below
Ctrl + B toggle hide/show left sidebar
Ctrl + S save and checkpoint
Ctrl + Shift + S save as
| Lenovo Thinkcentre M92P | |
| When booting to USB installer disk installation proceeds as expected | |
| 1962 no operating system found | |
| When booting into preview mode all disks load without issue, so its not the cable | |
| Secure Boot option either not present or disabled | |
| Last time I fixed this by adding a fake line to the boot loader from instructions on the web | |
| Got a warning during installation about UEFI mode | |
| Windows Fast Startup disabled | |
| jfly comment below: |
Side note: The latest edge build of KeeAgent plugin offers an option for creating a WSL compatible socket. This would be very handy. I already tried to use that socket, but the socket file is currently empty and ssh inside WSL 2 is unable to use it. This appears to be a very new, unreleased and unstable feature. I will follow the development of it and when it finally works (well, for me) I will update this HOWTO. But until then, please use the proven wsl-ssh-agent/npiperelay.exe approach below.
Thanks to the instructions for WSL 2 of the wsl-ssh-agent project, KeeAgent works great in WSL 2 now:
https://github.com/rupor-github/wsl-ssh-agent#wsl-2-compatibility
The approach uses minimal and well-maintained tools.
| # This script takes a video's individual frames and overlays them to produce a composite "long exposure" image. | |
| # | |
| # Usage: python expose.py video.mp4 width height | |
| # | |
| # IMPORTANT: you'll need to edit this script to set the value of 'alpha' appropriate for your video's length and desired brightness. | |
| from __future__ import division | |
| import subprocess as sp | |
| import numpy | |
| from PIL import Image, ImageDraw |
| $files = gci $Env:LocalAppData\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\LocalState\Assets | | |
| where Length -gt 1kb | |
| if ($files) { | |
| $shell = New-Object -ComObject Shell.Application | |
| $folder = "$Env:USERPROFILE\Pictures\Spotlight" | |
| if (!(Test-Path $folder)) { mkdir $folder } | |
| $files | % { | |
| $_ | Copy-Item -Destination $folder\$_.jpg | |
| Get-Item $folder\$_.jpg | |
| } | % { |