Skip to content

Instantly share code, notes, and snippets.

Avatar

Jean-Philippe Ouellet jpouellet

View GitHub Profile
@jpouellet
jpouellet / README.md
Last active Jun 18, 2018
OpenBSD kernel testing automation
View README.md

This assumes you have:

  • a development machine, here called "dev"
  • a device under test, here called "dut"
  • a serial console to dut
  • network access from dut to dev
  • the same arch dev and dut

You may need to change:

  • GENERIC (in dev:.ssh/authorized_keys) to something else, e.g. maybe GENERIC.MP
@jpouellet
jpouellet / openbsd-next.sh
Last active May 1, 2019
Safely & monotonically fetch OpenBSD snapshots
View openbsd-next.sh
#/usr/bin/env -i /bin/ksh
set -e
d=$(mktemp -d)
installurl=$(cat /etc/installurl)
ver=snapshots # uname -r
arch=$(machine)
baseurl="$installurl/$ver/$arch"
@jpouellet
jpouellet / mimeapps.list
Created May 12, 2017
Qubes screenshot helper
View mimeapps.list
[Added Associations]
image/png=qubes-movetovm.desktop;
@jpouellet
jpouellet / qvm-filemanager.pl
Last active Jun 16, 2019
Qubes OS: Opens a file manager in the focused VM
View qvm-filemanager.pl
#!/usr/bin/env perl
use strict;
use warnings;
sub open_file_manager {
my $vm = shift;
exec {'qvm-run'} ('qvm-run', '--', $vm, 'exec nautilus --new-window --no-desktop </dev/null >/dev/null') or die "qvm-run exec failed\n";
}
@jpouellet
jpouellet / duckhunter2.py
Last active Nov 1, 2019
A script to hunt ducks on IRC. Don't mind me...
View duckhunter2.py
#!/usr/bin/env python3
from sys import stdin
from random import choice
from time import sleep
duck_tail = "・゜゜・。。・゜゜"
duck = ["\_o< ", "\_O< ", "\_0< ", "\_\u00f6< ", "\_\u00f8< ", "\_\u00f3< "]
duck_noise = ["QUACK!", "FLAP FLAP!", "quack!"]
@jpouellet
jpouellet / jpo.WriteUSB
Created Mar 31, 2017
qubes-rpc service to write image to USB stick & return hash of contents actually written
View jpo.WriteUSB
#!/bin/bash
if [ $# -eq 0 ]; then
dev=/dev/sda
else
# Protected by arg-specific qubes-rpc policy.
dev=/dev/"$1"
fi
if ! [ -b "$dev" ]; then
@jpouellet
jpouellet / qvm-port-forward.sh
Last active Feb 13, 2021
Forwards a specified port to a specified VM, auto-detecting its NetVM chain. (Qubes OS)
View qvm-port-forward.sh
#!/bin/sh
# Inspired by https://gist.github.com/daktak/f887352d564b54f9e529404cc0eb60d5
ip() { qvm-ls --raw-data ip -- "$1"; }
netvm() { qvm-prefs -g -- "$1" netvm; }
forward() {
local from_domain=$1
local to_domain=$2
@jpouellet
jpouellet / qubes-shutdown-focused.sh
Last active Dec 21, 2016
Shuts down the focused VM in Qubes
View qubes-shutdown-focused.sh
#!/bin/sh
# PROBLEM: Allows the front VM to close its focused window right before
# keystroke delivery, leading to shutting down the VM with the window in
# back. Effective denial of service.
set -e
front=$(xprop -notype -root _NET_ACTIVE_WINDOW | awk '{if (match($0,"^_NET_ACTIVE_WINDOW: window id # (0x[0-9a-f]*), 0x0$",m)){print m[1];} exit 0;}' )
test -n "$front"
View idle-watcher.py
#!/usr/bin/python
# -*- encoding: utf8 -*-
#
# The Qubes OS Project, http://www.qubes-os.org
#
# Copyright (C) 2015 Marek Marczykowski-Górecki
# <marmarek@invisiblethingslab.com>
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
@jpouellet
jpouellet / iwl-reset.sh
Last active Dec 10, 2016
Reload drivers for my intel wireless card automatically if it hangs (on suspend/resume)
View iwl-reset.sh
#!/bin/sh
lock=/var/run/lock/iwl-reset.lock
fail_msg='iwlwifi 0000:00:00.0: Failed to load firmware chunk!'
do_reset='
echo "Resetting wifi..."
rmmod iwlmvm
rmmod iwlwifi