Skip to content

Instantly share code, notes, and snippets.

View wrouesnel's full-sized avatar

Will Rouesnel wrouesnel

View GitHub Profile
@wrouesnel
wrouesnel / gist:418fc39f70f04ad2ab56b099c6955540
Created April 12, 2017 17:23
rsyslog for structured output
module(load="imfile" mode="inotify")
input(type="imfile"
Tag="log"
File="/run/*.log"
Ruleset="applogs"
addMetadata="on")
template(name="jsonfmt" type="list") {
@wrouesnel
wrouesnel / enforcing.txt
Last active December 25, 2017 23:30
missing JF selinux policy for lineageOS prox sensor
[29445.118865] [SSP]: proximity_open_lcd_ldi - 40
[29445.118957] [SSP]: proximity_open_calibration - Can't open cancelation file
[29445.119415] type=1400 audit(1514243525.682:189): avc: denied { search } for pid=2392 comm="Binder:1846_6" name="/" dev="mmcblk0p10" ino=2 scontext=u:r:system_server:s0 tcontext=u:object_r:efs_file:s0 tclass=dir permissive=0
[29445.119873] [SSP]: Proximity Threshold - 60, 45
[29445.133789] type=1300 audit(1514243525.682:189): arch=40000028 syscall=4 per=800008 success=yes exit=5 a0=f0 a1=930ab568 a2=5 a3=1000000 items=1 ppid=1496 pid=2392 auid=4294967295 uid=1000 gid=1000 euid=1000 suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=(none) ses=4294967295 comm="Binder:1846_6" exe="/system/bin/app_process32" subj=u:r:system_server:s0 key=(null)
[29445.136047] [lcd] PANEL ON
[29445.136291] [lcd] DSI ON
[29445.137084] type=1302 audit(1514243525.682:189): item=0 name=(null) inode=10583 dev=00:0d mode=0100444 ouid=1000 ogid=1000 rdev=00:00 obj=u:object_r:sysfs:s0
[29445.138244] type
Installed Packages
NetworkManager.x86_64 1:1.0.6-27.el7 @anaconda
NetworkManager-libnm.x86_64 1:1.0.6-27.el7 @anaconda
NetworkManager-tui.x86_64 1:1.0.6-27.el7 @anaconda
NetworkManager-wifi.x86_64 1:1.0.6-27.el7 @anaconda
acl.x86_64 2.2.51-12.el7 @anaconda
aic94xx-firmware.noarch 30-6.el7 @anaconda
alsa-firmware.noarch 1.0.28-2.el7 @anaconda
alsa-lib.x86_64 1.0.28-2.el7 @anaconda
alsa-tools-firmware.x86_64 1.0.28-2.el7 @anaconda
@wrouesnel
wrouesnel / getmail-idler.py
Last active April 4, 2018 22:34
A script to invoke getmail when accounts receive new mail. See http://wrouesnel.github.io/articles/A%20better%20Getmail%20IDLE%20client/ for more details.
#!/usr/bin/env python
# Getmail Idler Script v2
# Will Rouesnel
#
# This is a pure Python threading affair - there are better ways to do things
# epoll but there are much better libraries (like gevent) for that type of
# thing.
#
# Note: this script assumes you're running getmail with the "delete" option for
# the mailbox it checks - i.e. your inbox should always be cleared of all mail.
# Ansible playbook to use a transient EC2 image to build the container
- name: Creating a disposable worker
hosts: localhost
connection: local
tasks:
- name: locating latest docker host AMI
ec2_ami_find:
region: eu-central-1
owner: self
name: debian-8-docker-*
@wrouesnel
wrouesnel / udev-toy.go
Last active August 14, 2018 07:12
Interrogating udev with golang
/* Go-udev binding toy application showing the two major things you'd generally want to do with it. */
/* Go-udev binding toy application */
package main
import (
"fmt"
"github.com/jochenvg/go-udev"
"github.com/jkeiser/iter"
"os/signal"
@wrouesnel
wrouesnel / mypy-wrap
Created April 4, 2019 23:57
Wrapper script for mypy to allow clickable lines in Pycharm.
#!/bin/bash
# Parse the mypy output so we get full-filepaths
while read l ; do
relpath="$(echo $l | cut -d':' -f1)"
echo "$(readlink -f "$relpath"):$(echo $l | cut -d':' -f2-)"
done < <(mypy "$@")
exit $?
@wrouesnel
wrouesnel / scrambled-words-meme-disprover.py
Last active April 10, 2019 02:46
Just a little Python function which scrambles words like that first and last letter are all you need meme.
from random import SystemRandom
rand = SystemRandom()
def scrambler(txt):
"""Disprover for that meme about letter ordering in English."""
words = txt.split(" ")
result_words = []
for word in words:
shuffled = [c for c in word[1:-1]]
rand.shuffle(shuffled)
result_word = word[0] + "".join(shuffled) + word[-1]
@wrouesnel
wrouesnel / vscode-extension-mirror.py
Last active April 29, 2019 15:03
Prototype code to mirror the VSCode extension repository
#!/usr/bin/env python3
# Script to mirror the VSCode extensions repository
# Sample download URL of a package:
# https://marketplace.visualstudio.com/_apis/public/gallery/publishers/rebornix/vsextensions/Ruby/0.22.3/vspackage
# transliterated: https://marketplace.visualstudio.com/_apis/public/gallery/publishers/{publisherName}/vsextensions/{name}/{version}/vspackage
from pprint import pprint
import requests
@wrouesnel
wrouesnel / gist:ab21e9ab51774043db9f010c1f8a6fa3
Created October 28, 2019 21:25
avl_find null pointer dereference on a broken pool
[12804.765044] Oops: 0000 [#1] SMP PTI
[12804.768934] CPU: 2 PID: 4670 Comm: txg_sync Tainted: P O 5.3.0-19-generic #20-Ubuntu
[12804.779028] Hardware name: Intel Corporation S1200RP/S1200RP, BIOS S1200RP.86B.01.04.0002.011020141517 01/10/2014
[12804.790523] RIP: 0010:dle_enqueue_subobj.isra.0+0x25/0x110 [zfs]
[12804.797234] Code: 0f 1f 44 00 00 0f 1f 44 00 00 55 48 89 e5 41 57 41 56 4d 89 c6 41 55 49 89 cd 41 54 49 89 fc 53 48 89 d3 48 83 ec 10 48 8b 3f <4c> 8b 7a 58 48 89 75 d0 e8 9e b3 fd ff 4c 8d
43 20 4c 3b b8 40 01
[12804.818189] RSP: 0018:ffffaf8f43fb74e0 EFLAGS: 00010282
[12804.824018] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 000000000008e009
[12804.831978] RDX: 0000000000000000 RSI: ffffa01be6d4a978 RDI: ffffa01ce3f6d000
[12804.839944] RBP: ffffaf8f43fb7518 R08: ffffa01af1bc99c0 R09: 0000000000000000