Skip to content

Instantly share code, notes, and snippets.

View kromych's full-sized avatar
🔆
Quien lo hizo

kromych

🔆
Quien lo hizo
View GitHub Profile
@kromych
kromych / set-pretty-git-log-alias.sh
Created August 17, 2025 22:10 — forked from niun/set-pretty-git-log-alias.sh
git log graph --oneline with date and author and colored ref names as alias
## One line per log entry with merge graph
## (--decorate is implicit for newer git versions?):
#git log --graph --oneline --decorate
## |
## Add --branches --remotes --tags --merges to see entries for all of the
## corresponding refs, not only commits (--all for all refs).
## Format output with --pretty=tformat:'<format>'
## Interesting placeholders for oneline <format>:
#!/usr/bin/env python3
import usb.core
import struct
from collections import namedtuple
APPLE_VID = 0x05ac
Target = namedtuple("Target", ["vid", "pid", "name", "model", "total_size"])
cargo clippy --fix -- -D clippy-pedantic -A use-debug
@kromych
kromych / rtlcompress.c
Created June 5, 2021 20:16 — forked from odzhan/rtlcompress.c
Compression using NT Layer DLL API
/**
BSD 3-Clause License
Copyright (c) 2019 Odzhan. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
@kromych
kromych / CheckGuestVmcsFieldsForVmEntry.c
Created February 21, 2021 05:21 — forked from tandasat/CheckGuestVmcsFieldsForVmEntry.c
Simulation of checks performed as per 26.3 CHECKING AND LOADING GUEST STATE
/**
* @file CheckGuestVmcsFieldsForVmEntry.c
* @author Satoshi Tanda ([email protected])
* @brief Checks validity of the guest VMCS fields for VM-entry as per
* 26.3 CHECKING AND LOADING GUEST STATE
* @version 0.1
* @date 2021-02-20
*
* @details This file implements part of checks performed by a processor during
* VM-entry as CheckGuestVmcsFieldsForVmEntry(). This can be called on VM-exit
@kromych
kromych / kvm-host.c
Created February 3, 2021 07:02 — forked from ricarkol/kvm-host.c
Tiny KVM host to at least partially run Linux kernel
#define _GNU_SOURCE
#include <asm/bootparam.h>
#include <errno.h>
#include <fcntl.h>
#include <linux/kvm.h>
#include <linux/kvm_para.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@kromych
kromych / vsock-notes.md
Created October 11, 2020 22:00 — forked from nrdmn/vsock-notes.md
vsock notes

vsock notes

about vsocks

Vsocks are a means of providing socket communication (either stream or datagram) directly between VMs and their host operating system. The host and each VM have a 32 bit CID (Context IDentifier) and may connect or bind to a 32 bit port number. Ports < 1024 are privileged ports.

Simple vsock setup for QEMU

Configuration

Host Kernel: rawhide 4.13.0-0.rc6.git4.2.fc28.x86_64 (on Fedora 24)

QEMU is mainline built from sources: QEMU emulator version 2.10.50 (v2.10.0-105-g223cd0e)

Guest: clear-17460-kvm.img (which has vsock support)

@kromych
kromych / gist:5f40609e8f7ec9a23d43edd5ec1af16e
Created July 18, 2020 05:18
Sort lines of a text file in Rust
use std::fs::{read_to_string, File};
use std::io::{BufWriter, Error, Write};
use std::time::Instant;
fn main() -> Result<(), Error> {
let now = Instant::now();
let wordlist = read_to_string("randomized.txt")?;
let mut list: Vec<&str> = wordlist.split_ascii_whitespace().collect();