Skip to content

Instantly share code, notes, and snippets.

@RSully
RSully / freadit.php
Created January 12, 2016 02:45
Keep trying to copy a file until success.
<?php
$path = '/Volumes/drive/path.dat';
$write_to = '/tmp/output.dat';
$fh_out = fopen($write_to, 'w+');
clearstatcache();
while (!file_exists($path)) {
sleep(1);
@RSully
RSully / bourne.fish
Last active January 18, 2018 05:14
Source *sh environments from fish.
function set_bourne
set --local line $argv[1] # the line X=Y
set --local exp $argv[2] # 1/0: export the variable
set --local key (echo $line | perl -pe 's/^([A-Za-z0-9_]+)=(.*)/$1/g')
set --local dataraw (echo $line | perl -pe 's/^([A-Za-z0-9_]+)=(.*)/$2/g')
set --local data $dataraw
# echo "in set_bourne for $key with $exp"
# echo "old value: $$key"
# This documents how you would take a Debian 12 cloud image and make a Proxmox template out of it.
# This script isn't really meant to be executed, but more as a reference and copy/paste for each step.
# Enjoy!
# Download the image
mkdir -p ~/debian-bookworm-build/original && cd ~/debian-bookworm-build/original
wget 'https://cloud.debian.org/images/cloud/bookworm/20240717-1811/debian-12-genericcloud-amd64-20240717-1811.qcow2'
cd ..