Skip to content

Instantly share code, notes, and snippets.

@rofrol
rofrol / zig_update.zig
Last active July 7, 2023 06:33 — forked from doccaico/zig_update.zig
Ziglang Updater in Ziglang
We couldn’t find that file to show.
const std = @import("std");
fn splice(src_rd: anytype, dst_wr: anytype, comptime buf_len: usize, lim: usize) !void {
var buf: [buf_len]u8 = undefined;
var left = lim;
while (true) {
const len = try src_rd.read(buf[0..@min(left, buf.len)]);
if (len == 0) break;
left = try std.math.sub(usize, left, len);
try dst_wr.writeAll(buf[0..len]);
@rofrol
rofrol / build_and_deploy.sh
Last active July 20, 2024 08:24
Girhub action to deploy with rsync without storing ssh creds in file system
#!/bin/bash
set -o allexport
source .env
set +o allexport
cd webapp && npm run build && cd .. &&
ssh ${SSH_USER}@${SSH_HOST} -p $SSH_PORT "mkdir -p /var/www/example.com/webapp" &&
rsync -avzr --delete --filter=':- .gitignore' -e 'ssh -p '${SSH_PORT} webapp/dist/webapp/ ${SSH_USER}@${SSH_HOST}:/var/www/example.com/webapp/
@rofrol
rofrol / linux-vms-on-apple-m1-with-networking.md
Created April 29, 2025 07:59 — forked from max-i-mil/linux-vms-on-apple-m1-with-networking.md
Short summary to run Linux VMs on an Apple M1 host using QEMU, libvirt and HVF with a working network setup

Linux Virtual Machines with Private Network on an Apple M1 Device

Background

The aim was to be able to:

  1. Run multiple Linux VMs on an Apple M1/ARM device
  2. Use Apple's HVF for native performance speeds
  3. Configure VMs to allow network access to each other
  4. Configure VMs to allow access to the internet
  5. Not rely on custom modifications of software
@rofrol
rofrol / macos_tips.md
Last active July 4, 2025 16:05
tips for a lifetime windows user switching to mac
  1. To have switching with alt+tab and window previews, install https://formulae.brew.sh/cask/alt-tab. You may need to change in settings alt+tab to Show windows from applications: All apps.
  2. To have fast switching between fullscreen windows: don't fullscreen and just autohide top bar instead. You may also autohide dock. One downside if you move mouse to top bar and click to fast, you will show desktop instead. Threre is some possibility for fast switching with fullscreen windows with https://github.com/koekeishiya/yabai but is hacky.
  3. Install https://brew.sh. Disable qurantine with export HOMEBREW_CASK_OPTS=--no-quarantine in ~/.zshrc link. To upgrade packages without asking for root password many times https://github.com/rofrol/dotfiles/blob/master/bin/brew-update. To list brew packages https://github.com/rofrol/dotfiles/blob/master/bin/brew-packages.
  4. Learn Finder shortcuts: enter to rena