Skip to content

Instantly share code, notes, and snippets.

@Postrediori
Postrediori / rotate-video.sh
Last active December 28, 2019 16:56
Script for downloading a video with orbits of Jupiter&asteroids and fixing rotation on Jupiter
#!/bin/bash
#
# Download Jupiter/asteroids video and fix Jupiter's rotation
#
# Tweet address with source video:
# https://mobile.twitter.com/AntonioParis/status/994224252961386496
#
# Required utils:
# * curl
# * convert

Launch Win32 executables on ARM host with QEMU and Wine

Introduction

This is guide describes the way to run Win32 executable files on ARM host (e.g. tablet) with Ubuntu 18.04 (16.04, 20.04 etc).

Outline

  1. Build static qemu-user-i386 on ARM host
  2. Type magic strings for Win32 executable file format in binfmts
/*
libbase : version 0.09 ~byuu (2007-01-24)
*/
#ifndef __LIBBASE
#define __LIBBASE
#if defined(_MSC_VER)
//disable libc deprecation warnings in MSVC 2k5+
#pragma warning(disable:4996)
@Postrediori
Postrediori / Linux-EDUP-Wireless.md
Last active May 29, 2021 10:37
Linux setup for EDUP 802.11AC 1200M Dual Band USB wireless adapter

Description

New EDUP 802.11AC 1200M Dual Band USB wireless adapter does not work in Linux distributions by default. At least the following distributions lack the required kernel module:

  • Ubuntu 20.04
  • Ubuntu 21.04
  • Fedora 34

Solution

Manually build rtl88x2bu module from sources at cilynx/rtl88x2bu

@Postrediori
Postrediori / images_to_video.py
Created September 15, 2021 06:16
Convert video frames to video
#
# Convert images to video
#
# Example:
# python video.py -i 8012 -l 8151 -f 30 -t 800x600/IMG_%FRAME_NUM%_result.jpg
#
# ffmpeg command line from: https://github.com/justin-bennington/somewhere-ml/blob/main/S2_GAN_Art_Generator_(VQGAN%2C_CLIP%2C_Guided_Diffusion).ipynb
#
from PIL import Image
@Postrediori
Postrediori / MSVisualStudioOffline.md
Last active January 6, 2022 11:13
Creating offline cache for MS Visual Studio

Create a local install cache

For C++ desktop development, run:

vs_community.exe --layout C:\VS2022Cache --add Microsoft.VisualStudio.Workload.NativeDesktop --includeRecommended --lang en-US

For .NET desktop development, run:

ImageMagick HowTo

Resize and crop image

convert input.jpg -resize 100x100^ \
                  -gravity Center  \
                  -crop 100x100+0+0 +repage  \
        output.jpg
@Postrediori
Postrediori / ZshGitStatus.md
Created May 18, 2022 12:47
Show Git status in zsh prompt

Add the following config to .zshrc:

# Load colors
autoload -U colors && colors

# Load version control information
autoload -Uz vcs_info
precmd() { vcs_info }
@Postrediori
Postrediori / WinHandles.hpp
Created May 29, 2022 12:47
Windows.h replacement for headers by Sebastian Aaltonen (https://twitter.com/SebAaltonen/status/1530152876655386624)
#ifndef __F_WINHANDLES_HPP__
#define __F_WINHANDLES_HPP__
typedef void* HANDLE;
typedef unsigned long long WPARAM;
typedef long long LPARAM;
typedef long long LRESULT;
#define FORWARD_DECLARE_HANDLE(name) structname##__; typedef struct name##__ *name;
FORWARD_DECLARE_HANDLE(HINSTANCE);
@Postrediori
Postrediori / Upgrade-DigitalOcean-Ubuntu-Droplet-LTS.md
Last active October 3, 2022 11:31
Upgrade DigitalOcean Ubuntu Droplet to the Next LTS Version

Description

The instructions here cover upgrading Ubuntu droplet from one LTS release to the next one. This was used to incrementally upgrade from Ubutnu 16.04 to 20.04 via 18.04.

Instructions

Perform standard update