Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View asakasinsky's full-sized avatar

Vasily Asakasinsky asakasinsky

View GitHub Profile
@asakasinsky
asakasinsky / vm-backup.sh
Created February 6, 2024 07:12 — forked from cabal95/vm-backup.sh
I use this script to backup my QEMU/KVM/libVirt virtual machines. The script requires KVM 2.1+ since it uses the live blockcommit mode. This means the data in the snapshot disk is rolled back into the original instead of the other way around. Script does NOT handle spaces in paths.
#!/bin/bash
#
BACKUPDEST="$1"
DOMAIN="$2"
MAXBACKUPS="$3"
if [ -z "$BACKUPDEST" -o -z "$DOMAIN" ]; then
echo "Usage: ./vm-backup <backup-folder> <domain> [max-backups]"
exit 1
@asakasinsky
asakasinsky / resize_disk_image.md
Created February 6, 2024 07:11 — forked from joseluisq/resize_disk_image.md
How to resize a qcow2 disk image on Linux

How to resize a qcow2 disk image on Linux

This example takes olddisk.qcow2 and resizes it into newdisk.qcow2, extending one of the guest's partitions to fill the extra space.

1. qcow2 format

1.1. Verify the filesystems of olddisk.qcow2

@asakasinsky
asakasinsky / mount_qcow2.md
Created February 3, 2024 14:45 — forked from shamil/mount_qcow2.md
How to mount a qcow2 disk image

How to mount a qcow2 disk image

This is a quick guide to mounting a qcow2 disk images on your host server. This is useful to reset passwords, edit files, or recover something without the virtual machine running.

Step 1 - Enable NBD on the Host

modprobe nbd max_part=8
@asakasinsky
asakasinsky / Documentation.md
Created August 29, 2023 15:30 — forked from KartikTalwar/Documentation.md
Rsync over SSH - (40MB/s over 1GB NICs)

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@asakasinsky
asakasinsky / Dockerfile
Created June 20, 2023 07:53 — forked from prsanjay/Dockerfile
Dockerfile that install package manually from .deb file
FROM ruby:2.6.1
RUN curl -sL https://deb.nodesource.com/setup_8.x | bash \
&& apt-get update && apt-get install -y nodejs xvfb libfontconfig wkhtmltopdf && rm -rf /var/lib/apt/lists/* \
&& curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - \
&& echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list \
&& apt-get update && apt-get install -y yarn && rm -rf /var/lib/apt/lists/*
# Packages for wkhtmltopdf. These are available in ubuntu but not in debian 9. Base image uses debian 9.
RUN wget -q -O /tmp/libjpeg-turbo8.deb http://archive.ubuntu.com/ubuntu/pool/main/libj/libjpeg-turbo/libjpeg-turbo8_2.0.1-0ubuntu2_amd64.deb \
&& dpkg -i /tmp/libjpeg-turbo8.deb \
@asakasinsky
asakasinsky / starship.toml
Created June 14, 2023 18:55 — forked from 3ayazaya/starship.toml
My Starship terminal configuration file
#format = """
#[╭─user───❯](bold blue) $username
#[┣─system─❯](bold yellow) $hostname
#[┣─project❯](bold red) $directory$rust$git_branch$git_status$package$golang$terraform$docker_context$python$docker_context$nodejs
#[╰─cmd────❯](bold green)
#"""
[username]
style_user = "green bold"
style_root = "red bold"
format = "[$user]($style) "
@asakasinsky
asakasinsky / starship.toml
Created June 14, 2023 13:07 — forked from jmg-duarte/starship.toml
starship.toml
# add_newline = false
format="""\
$directory\
$package\
$git_branch\
$line_break\
$hostname\
$character\
"""
@asakasinsky
asakasinsky / starship.nix
Created June 14, 2023 13:07 — forked from s-a-c/starship.nix
Nix file to generate complete, mostly default, starship.toml, including equivalent of <format = "$all">
programs.starship = {
enable = true;
settings = {
# "$schema" = "https://starship.rs/config-schema.json";
add_newline = true;
command_timeout = 500;
continuation_prompt = "[∙](bright-black) ";
format = "[](0x9A348E)$username$hostname$localip$shlvl$singularity$kubernetes[](fg:0x9A348E bg:0xDA627D)$directory$vcsh[](fg:0xDA627D bg:0xFCA17D)$git_branch$git_commit$git_state$git_metrics$git_status$hg_branch[](fg:0x86BBD8 bg:0x06969A)$docker_context$package$buf[](fg:0xFCA17D bg:0x86BBD8)$c$cmake$cobol$container$daml$dart$deno$dotnet$elixir$elm$erlang$golang$haskell$helm$java$julia$kotlin$lua$nim$nodejs$ocaml$perl$php$pulumi$purescript$python$rlang$red$ruby$rust$scala$swift$terraform$vlang$vagrant$zig$nix_shell$conda$spack$memory_usage$aws$gcloud$openstack$azure$env_var$crystal$custom$sudo$cmd_duration$line_break$jobs$battery[](fg:0x06969A bg:0x33658A)$time$status$shell$character";
right_format = "";
scan_timeout = 30;
@asakasinsky
asakasinsky / starship.toml
Created June 14, 2023 12:50 — forked from notheotherben/starship.toml
A Powerline configuration for Starship.rs
format = """
[\uE0B6](fg:#1C4961)[$directory](bg:#1C4961)[\uE0B0](fg:#1C4961 bg:#2F79A1)$git_branch[\uE0B0](fg:#2F79A1 bg:#3A95C7)$git_status[\uE0B0](#3A95C7 bg:#40A9E0)$time[\uE0B0](#40A9E0 bg:none) $all$character """
add_newline = true
[directory]
style = "bg:#1C4961 fg:white"
[git_branch]
format = "[ $symbol$branch ]($style)"
@asakasinsky
asakasinsky / main.c
Created May 28, 2023 01:51 — forked from indragiek/main.c
Simple key logger for OS X using CGEventTap
// Super simple key logger that uses a CGEventTap to log
// the unicode strings for each key down event
// Doesn't handle special keys (enter, backspace, etc.)
#include <stdio.h>
#import <Carbon/Carbon.h>
#import <ApplicationServices/ApplicationServices.h>
CGEventRef loggerCallback(CGEventTapProxy proxy, CGEventType type, CGEventRef event, void* context)
{