Skip to content

Instantly share code, notes, and snippets.

View EmmanuelKasper's full-sized avatar

Emmanuel Kasper EmmanuelKasper

  • Vienna, Austria
View GitHub Profile
@EmmanuelKasper
EmmanuelKasper / gist:f24cc7088b206ea0ec87
Last active January 4, 2024 10:40
Proxmox Text Terminal Howto

Map a virtual serial port on the guest(ttyS0) to a pseudo terminal(pty) on the host This has to be added to /etc/pve/qemu-server/VMID.conf:

args: -device isa-serial,chardev=myChardevice,id=s -chardev pty,id=myChardevice

After starting the VM check you will see a message:

char device redirected to /dev/pts/7 (label myChardevice)

Inside the guest, you should see now the serial port:

@EmmanuelKasper
EmmanuelKasper / EFI boot on Lenovo Thinkcenter M92Z
Last active February 14, 2023 13:02
EFI boot on Lenovo Thinkcenter M92Z
# disable secure boot in the bios, in menu security
# downlad and unzip refind-bin-0.7.8.zip
# install refind, assuming your ESP partition is /dev/sda1 and mounted in /boot/efi
cd refind-bin-0.7.8
./install.sh
# type y and go ahead
# at that time your boot entry should look like that
From: Emmanuel Kasper <manu@xx.yy>
Date: Fri, 2 Apr 2021 14:25:28 +0200
Subject: [PATCH] Use absolute path to oc binary, as we install it outside of
$PATH
---
.../openshift-4-cluster/tasks/post-install-storage-nfs.yml | 2 +-
ansible/roles/openshift-4-cluster/tasks/post-install.yml | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
@EmmanuelKasper
EmmanuelKasper / bmi.py
Last active December 25, 2019 22:19
Different line joinings in pyton
#!/usr/bin/python3
def output():
# explicit line joining with backslash (prefered for simple strings)
print("let's do some calculations \
of the body mass index")
# explicit line joining with operator # generally prefered, allows to keep indentation consistent
# PEP 8 recommends operator on the next line
print(f"weight: 75, size: 1.77 "
+ f"bmi: {bmi_calc(75,1.77)}")
@EmmanuelKasper
EmmanuelKasper / convert.sh
Last active January 13, 2019 21:11
Convert images for Atari ST resolution
# with dithering
convert input.jpg -resize 640x400\! -colorspace gray -colors 2 -normalize output.gif
# without dithering, strong separation
convert input.jpg -resize 640x400\! -colorspace gray +dither -colors 2 -normalize output.gif
# see http://www.multipole.org/discourse-server/viewtopic.php?t=34042 for background
# convert to low resultion for atari ST 16 colors / 4096 palette
convert rio_hill.jpg -colors 16 -depth 4 -resize 320x200\! rio.gif
@EmmanuelKasper
EmmanuelKasper / create_gif.sh
Created July 10, 2015 08:56
Create gif file with avconf
#export frames
avconv -i hatari.avi -vf fps=10 frames/ffout%03d.png
#assemble frames a gif
convert -loop 0 frames/ffout0*.png new.gif
@EmmanuelKasper
EmmanuelKasper / wget.js
Last active August 8, 2018 08:37
Nodejs shell like programming: calling an external command and returning output to stdout
#! env node
// execFileSync will call the command directly without using a shell, a tad faster and prevents interpretation of characters
// ( similar to C and java exec )
const exec = require('child_process').execFileSync;
// inherit will use the stdio of the parent process, ie this nodejs script
exec('wget', ['https://git.kernel.org/torvalds/t/linux-4.18-rc8.tar.gz', '--output-document', '/tmp/bla'], {stdio:'inherit'});
@EmmanuelKasper
EmmanuelKasper / kvm-autostable
Last active February 21, 2018 09:28
A script to automatically install Debian Wheezy on a KVM guest
#!/bin/sh
# You can optionally connect to the VM with
# virt-viewer -c qemu:///system Debian7
export OS=Debian7
virt-install \
--connect qemu:///system \
--name ${OS} \
--ram 1024 \
--vcpus 1 \
@EmmanuelKasper
EmmanuelKasper / vmake.pl
Created October 13, 2017 11:19
Make wrapper to execute make file in a sandbox VM
#!/usr/bin/perl
use strict;
use warnings;
use English;
use Sys::Virt;
use Net::OpenSSH;
use File::Spec;
use File::Basename;
use Cwd 'realpath';

commands

#client 
iperf -c pf -i 1 -t 60
#server
iperf -s

server side result vr2: VIA VT6105M Rhine III 10/100BaseTX