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/