This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./pxcr --help | |
pxcr - Probabilistic XOR Error Correction | |
Copyright (C) 2017, 2018 Christian Thaeter <ct.pxcr@pipapo.org> | |
usage: | |
pxcr <mode> [options..] | |
pxcr --help [topic] | |
modes are: | |
--create - create redundancy files |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn init_segv_handler() { | |
use libc::*; | |
unsafe extern "C" fn handler(signum: c_int) { | |
let mut sigs = std::mem::MaybeUninit::uninit(); | |
sigemptyset(sigs.as_mut_ptr()); | |
sigaddset(sigs.as_mut_ptr(), signum); | |
sigprocmask(SIG_UNBLOCK, sigs.as_ptr(), std::ptr::null_mut()); | |
panic!("SEGV!"); | |
} | |
unsafe { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait PathNormalize { | |
fn normalize(&self) -> PathBuf; | |
} | |
impl PathNormalize for Path { | |
fn normalize(&self) -> PathBuf { | |
use std::path::Component::*; | |
let mut normalized = PathBuf::new(); | |
for component in self.components() { | |
match component { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
shift | |
cmd="${1:-build}" | |
shift | |
if [[ "$TERM" = "dumb" ]]; then | |
fmt=json | |
else | |
fmt=json-diagnostic-rendered-ansi | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::ffi::{CStr, CString}; | |
use std::time::Duration; | |
use std::thread; | |
unsafe fn copy_fd(fd: libc::c_int) -> libc::c_int { | |
let dot = CString::new(".").unwrap(); | |
libc::openat(fd, dot.as_ptr(), libc::O_DIRECTORY) | |
} | |
fn main() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source ssh-cron-agent | |
RSTORE_LIMIT_PERCENT=94 | |
RSTORE_LIMIT_INODES=94 | |
RSTORE_TRIES=2 | |
rstore_cleanup rootserver styx charon rpi dionysos ..... and so on |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+ .vaultbackup-pre.rsync | |
dir-merge /.backup-pre.rsync | |
+ backup-pre.rsync | |
dir-merge /backup-pre.rsync | |
merge fullsystem.rsync | |
-C | |
- .hg | |
+ .backup.rsync | |
dir-merge /.backup.rsync | |
+ backup.rsync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd ~/backups | |
if rstore_idle rpi && rstore_last_older_than rpi 1 days; then | |
source global.rstore | |
rstore_backup rpi root@rpi.pipapo.org:/ --fake-super -m --rsync-path="ionice -c 3 nice -n 15 rsync" | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdint.h> | |
#include <stdlib.h> | |
#include <stddef.h> | |
#define TMP_ALLOCA_MAX 4000 // should be fairly smaller than pagesize | |
#if defined __GNUC__ || defined __clang__ || defined __IBM__ALIGNOF__ | |
# define mem_alignof __alignof__ | |
#else | |
#define mem_alignof(type) offsetof(struct { char a_; type member; }, member) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo_funcs=(apt /etc/cron.daily/autokernel) | |
for func in "${sudo_funcs[@]}"; do | |
name="${func##*/}" | |
source <(cat <<<"function $name () { sudo -- $func \"\$@\"; }") | |
done | |
NewerOlder