Skip to content

Instantly share code, notes, and snippets.

View raspi's full-sized avatar

raspi

  • finland
  • 12:34 (UTC +03:00)
View GitHub Profile
@raspi
raspi / Quick Linux iptables NAT.md
Last active July 20, 2022 17:13
Quick NAT with GNU/Linux iptables firewall

Quick NAT with GNU/Linux iptables firewall.

First set static IP for LAN adapter:

ip address add 192.168.99.1/24 dev LANeth0

Enable packet forwarding:

echo 1 > /proc/sys/net/ipv4/ip_forward

Cakez TD demo on Linux Steam

Download from https://cakez77.itch.io/cakeztd

First unzip the demo .zip with Ark.

After unzipping you'll have broken filenames in single directory:

% LANG=C ls
@raspi
raspi / Deus Ex Mankind Divided - Remove intro videos.ps1
Created March 7, 2018 22:42
Remove annoying intro videos from Deus Ex Mankind Divided
# Remove annoying intro videos from Deus Ex Mankind Divided
# Finds DXMD path from registry
# Steam application id (337000 = Deus Ex Mankind Divided)
$steamAppId = 337000
# Empty BINK video
$emptyVideo = @(
0x4B, 0x4E, 0x49, 0x42, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@raspi
raspi / ffprobe_json.py
Created December 9, 2021 01:34
Get JSON from FFProbe
import json
import subprocess
from pathlib import Path
def ffprobe(path: Path):
cmd = [
"ffprobe",
"-v", "error",
"-select_streams", "v",
"-show_entries", "format=filename:stream=height",
$items = Get-ItemProperty -Path 'Registry::HKey_Local_Machine\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\*'
Foreach ($item in $items) {
$objUser = New-Object System.Security.Principal.SecurityIdentifier($item.PSChildName)
$objName = $objUser.Translate([System.Security.Principal.NTAccount])
$item.PSChildName = $objName.value
}
Write-Output $items | Select-Object -Property PSChildName, ProfileImagePath
# Fetch system specific information
# -- Get Operating system name such as "Win 10 Pro"
$replaceTable = @{
"Microsoft" = ""
"Windows" = "Win"
"Professional" = "Pro"
"Ultimate" = "Ult"
"Enterprise" = "Ent"
"Edition" = "Ed"
$Shell=$Host.UI.RawUI
$size=$Shell.WindowSize
$size.width=120
$size.height=35
$Shell.WindowSize=$size
# buffer
$size = $Shell.BufferSize
$size.width=[system.console]::BufferWidth
@raspi
raspi / censor.sh
Created March 27, 2021 01:20
Censor MAC address, IPv4 address from some output
# mac:
echo "..." | perl -pe 's@[\da-f:]{17}@xx:xx:xx:xx:xx:xx@ig'
# IPv4
echo "..." | perl -pe 's@[\d\.]{7,15}@X.X.X.X@ig'
@raspi
raspi / ffmpeg-crop.sh
Last active March 24, 2021 13:52
Crop video with FFMPEG
#!/bin/bash
# Crop a part of a video with FFMPEG
if [[ $# -eq 0 ]] ; then
echo "Usage:"
echo " $0 <filename> <left> <right> <top> <bottom>"
echo ""
echo "Example:"
echo " $0 myvid.mp4 700 600 200 400"
@raspi
raspi / ffmpeg-cut.sh
Last active March 24, 2021 13:52
Cut a part of a video with FFMPEG
#!/bin/bash
# Cut a part of a video with FFMPEG
if [[ $# -eq 0 ]] ; then
echo "Usage:"
echo " $0 <filename> <start position timestamp> <duration> [additional params]"
echo ""
echo "Example:"
echo " Cut 50 seconds starting from timestamp 01:23:45 from file myvid.mp4"