Skip to content

Instantly share code, notes, and snippets.

@petrivanes
petrivanes / AesGcmTest.java
Created January 14, 2024 17:45 — forked from patrickfav/AesGcmTest.java
Java Authenticated Encryption with AES and GCM.
package at.favre.lib.bytes.otherPackage;
import org.junit.Test;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.spec.GCMParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
@petrivanes
petrivanes / mount_qcow2.md
Created December 10, 2023 07:31 — 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
@petrivanes
petrivanes / ipv6-httpd.py
Last active November 28, 2023 15:21 — forked from akorobov/ipv6-httpd.py
quick ipv6 http server using python's SimpleHttpServer
import socket
from http.server import HTTPServer, SimpleHTTPRequestHandler
import io
class MyHandler(SimpleHTTPRequestHandler):
def do_GET(self):
if self.path == '/ip':
output = io.StringIO()
self.send_response(200)
self.send_header('Content-type', 'text/html')
@petrivanes
petrivanes / .tmux.conf
Created October 16, 2023 14:30 — forked from raygunsix/.tmux.conf
tmux config file
# Setting up the colors and copy/paste
set -g default-terminal "screen-256color"
# This is OS/X specific and should only be enabled when the 'reattach-to-user-namespace' is installed
set -g default-command "reattach-to-user-namespace -l /bin/bash"
bind C-c run "tmux save-buffer - | reattach-to-user-namespace pbcopy"
bind C-v run "tmux set-buffer $(reattach-to-user-namespace pbpaste); tmux paste-buffer"
# Make it use C-a, similar to screen..
unbind C-b