Skip to content

Instantly share code, notes, and snippets.

View vbrozik's full-sized avatar
☮️
Ukraine stay strong

Václav Brožík vbrozik

☮️
Ukraine stay strong
  • NTT Czech Republic
  • Czech Republic
  • 19:51 (UTC +02:00)
View GitHub Profile
@vbrozik
vbrozik / README.md
Last active October 19, 2023 14:41
jq JSON query
@vbrozik
vbrozik / wsl-ubuntu-prep.sh
Last active May 17, 2022 22:22
WSL Ubuntu preparation
#!/bin/sh
# Prepares freshly installed WSL
# Written for:
# WLS2, Ubuntu 22.04
sudo apt update
sudo apt install wslu
# TODO:
@backerman
backerman / profile-snippet-sshargcomplete.ps1
Last active April 30, 2024 08:58
Enable tab completion for ssh hostnames in PowerShell
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.
@shaybensasson
shaybensasson / pprint_color.py
Last active March 16, 2021 08:18 — forked from EdwardBetts/pprint_color.py
Python pprint with color syntax highlighting for the console (adapted for python3.6)
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()))
@discdiver
discdiver / jupyterlab_shortcuts.md
Last active June 10, 2024 07:28
Common Jupyter Lab Keyboard Shortcuts

If you are on a Mac, substitute command for control. Don't type the + (it means press both keys at once).

Shortcuts when in either command mode (outside the cells) or edit mode (inside a cell):

  • 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

@vees
vees / Lenovo Thinkcentre M92P.txt
Last active June 16, 2024 10:45
Ubuntu and UEFI on Lenovo Thinkcentre M92P
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:
@strarsis
strarsis / howto.md
Last active April 8, 2024 04:34
KeeAgent (for KeePass) on Bash on Windows / WSL (2)

Update (March 2023) (Last checked: March 2024)

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.

Mini-changelog

  • (16.03.2024) Add: Ensure 7z and wslvar being available (thanks @johnzielk
@timbennett
timbennett / expose.py
Last active June 11, 2023 00:36
Create 'long exposure' images from a video file.
# 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
@ygra
ygra / Get-SpotlightImages.ps1
Created November 16, 2016 10:05
A small PowerShell script to save Windows 10 lock screen images to a more accessible location.
$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
} | % {
@benyanke
benyanke / BASH: Reminder to 'git pull'
Last active April 28, 2022 12:34
BASH: Reminder to 'git pull'. This function hooks into CD to remind you to 'git pull' when entering a repository directory. It will only alert you every X seconds.
cd() {
# Seconds between alerts: raise this
# number if you want to get fewer alerts
# Default: 10 min
alertDelay=600
# Alert text: this is displayed when you
# CD into a git repo
alertText="\n##################################################\n This is a git repo. Don't forget to 'git pull'\n##################################################\n"