Skip to content

Instantly share code, notes, and snippets.

Avatar

Federico Ceratto FedericoCeratto

  • OONI / Tor Project / Debian
View GitHub Profile
@FedericoCeratto
FedericoCeratto / comp.sh
Last active Jul 25, 2020
Reproducible filesystem creation - trivial test
View comp.sh
#!/bin/bash
set -eu
gen() {
img="fs-test-$2.img"
rm -f $img
fallocate -l 150M $img
sudo mkfs.$1 $img >/dev/null 2>&1
}
for fs in btrfs jffs2 ext2 ext3 ext4 xfs fat vfat f2fs nilfs2; do
gen $fs 1
View httpclient.html
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
View index.html
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!-- This file is generated by Nim. -->
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
View packet.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@FedericoCeratto
FedericoCeratto / fabric_file_monitor.py
Last active Aug 29, 2015
Fabric - Monitor files for change and execute tasks using inotify (like inotifywait) #1295
View fabric_file_monitor.py
import inotifyx
from glob import glob
def _run_monitoring_loop(fd, globs, tasks):
"""Setup file monitoring and run Fabric tasks
"""
fnames = [fn for g in globs for fn in glob(g)]
if len(fnames) > 5:
print("Monitoring %d files..." % len(fnames))
View ssh-multi.sh
# ssh-multi
# Based on http://linuxpixies.blogspot.jp/2011/06/tmux-copy-mode-and-how-to-control.html
# a script to ssh multiple servers over multiple tmux panes
multimux() {
readarray hosts < "$1"
tmux new-window "ssh $1@${hosts[0]}"
View autossh init.d
#! /bin/sh
#
# Author: Andreas Olsson <andreas@arrakis.se>
# Version: @(#)autossh_tunnel.foo 0.1 27-Aug-2008 andreas@arrakis.se
#
# For each tunnel; make a uniquely named copy of this template.
## SETTINGS
#