Skip to content

Instantly share code, notes, and snippets.

@onomatopellan
onomatopellan / vhdx.txt
Last active January 21, 2024 21:57
How to automount an external vhdx file in WSL2
1. Ubuntu WSL2 must be already installed in C: system drive and user should be able to call windows binaries like wsl.exe from bash.
2. We will install Alpine WSL2 distro in an external partition/disk:
Download Alpine from here:
https://github.com/yuk7/AlpineWSL/releases/download/3.11.5-1/Alpine.zip
Extract the files in an external partition/disk. (for example D:\Alpine)
Make sure WSL2 is enabled by default (wsl.exe --set-default-version 2)
Inside the Alpine folder run Alpine.exe to install the Distro. An ext4.vhdx file will be created in that same folder.
@Ocramius
Ocramius / psalm-compendium.php
Last active November 9, 2023 07:27
A small compendium of what is possible with `vimeo/psalm` 3.9.x to add some decent type system features to PHP
<?php
// -- types are a compile-time propagated concept
// https://psalm.dev/r/338f74a96c
class TheType
{
/** @var string */
public $foo = 'bar';
}
@jlesage
jlesage / plex_dvr_post_processing.sh
Created February 18, 2019 10:38
Post-processing script for Plex DVR
#!/bin/bash
#
# Post-processing script for Plex DVR.
#
# This script is used to convert the video file produced by the DVR to a smaller
# version. The conversion is performed by a separate Docker container.
#
# For example, the HandBrake docker container is capable of automatically
# converting files put in a specific folder, called the "watch" folder. The
@matthiassb
matthiassb / dns-sync.sh
Last active March 20, 2024 12:12
Init.d script for keeping WSL resolv.conf in-sync with Windows
#! /bin/bash
### BEGIN INIT INFO
# Provides: dns-sync
# Required-Start:
# Required-Stop:
# Default-Start: S
# Default-Stop:
# Short-Description: Synchronizes /etc/resolv.conf in WLS with Windows DNS - Matthias Brooks
### END INIT INFO
@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@countingpine
countingpine / ext2scan.c
Last active December 19, 2021 18:06
ext2scan: scan for ext2/ext3/ext4 partitions
/* ext2scan:
* Scans an input stream, sector by sector, for something that looks like an ext{2,3,4} partition.
* It does this by looking for a magic WORD, 0xEF53, at a known offset into the sector.
* For random data, this will occur by chance around once per 32MB of data, so we also
* check whether the first two sectors are all zeros, which is commonly true for ext partitions.
*
* Compile with:
* gcc ./ext2scan.c -o ./ext2scan
*
* Example usage:
@EvgenyOrekhov
EvgenyOrekhov / A simple Docker and Docker Compose install script for Ubuntu.md
Last active May 5, 2024 20:06
A simple Docker and Docker Compose install script for Ubuntu

A simple Docker and Docker Compose install script for Ubuntu

Usage

  1. sh install-docker.sh
  2. log out
  3. log back in

Links

@T-Kuhn
T-Kuhn / .vimrc
Last active June 10, 2020 11:26
vimrc for raspberry pi
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather than Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
@ygotthilf
ygotthilf / jwtRS256.sh
Last active May 6, 2024 08:48
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@meiamsome
meiamsome / hn_search.js
Last active May 4, 2022 13:23 — forked from kristopolous/hn_seach.js
hn job query search
/* Hacker News Search Script
*
* Original Script by Kristopolous:
* https://gist.github.com/kristopolous/19260ae54967c2219da8
*
* Usage:
* First, copy the script into your browser's console whilst on the Hacker News
* jobs page. Then, you can use the query function to filter the results.
*
* For example,