Skip to content

Instantly share code, notes, and snippets.

cat /etc/polkit-1/localauthority/50-local.d/50-libvirt-remote-access.pkla
[libvirt Management Access]
Identity=unix-user:someuser;unix-user:youruser
Action=org.libvirt.unix.manage
ResultAny=yes
ResultInactive=yes
ResultActive=yes
@mailinglists35
mailinglists35 / file.txt
Last active January 25, 2019 22:13
What I learned today - Things I might else forget. Let's save this to a public gist on github
`seq -f %05g start end` helps produce numbers padded/prefixed with zeroes.
more on that via Secrets of “printf” by Professor Don Colton
https://web.archive.org/web/20180422200414/http://www.cypress.com/file/54441/download
`sed /string/d` deletes the line containing the string
`ssh -o StrictHostKeyChecking=no` automatically accepts and saves the public remote host key
`ssh -J user@remote:port` make use of a jump host
@mailinglists35
mailinglists35 / watch_dd_rhelper.sh
Created November 23, 2018 22:18
speed up dd_rhelp
# cat `which watch_dd_rhelper`
#!/bin/bash
PREVIOUS=/tmp/previous
LAST=/tmp/last
reset=false
while true; do
[ "$reset" == "false" ] || reset=false
cat /proc/$(pidof dd_rescue)/io > $PREVIOUS
sleep 10
@mailinglists35
mailinglists35 / www.pixelbeat.org-docs-rebuild_kernel_module.html
Last active March 12, 2019 11:19
this could vanish anytime from the web. rebuild kernel module. patch kernel centos redhat oracle
Building external modules is well documented, but I found the info for rebuilding a single distro kernel module quite disjoint, I guess because it spans both distribution and kernel specific info. Now rebuilding your whole distro kernel is going to take ages due to the number of modules enabled, so the instructions below show how to quickly rebuild and install the minimum required. Note these instructions are based on rpm using distros but should be easily translatable to ones using dpkg.
The specific examples below are to patch the snd_intel8x0 driver to get sound working on Fedora 11, and enabling experimental write support on the ufs module which I used to unbrick the FreeBSD based m0n0wall router in the office.
Get kernel versions and paths for automation
#cat ~/kernel.sh ~/args.sh
kernver=$(uname -r)
kernbase=$(echo $kernver | sed 's/\([0-9]*\.[0-9]*\.[0-9]*\).*/\1/')
rpmarch=$(rpm -q --qf="%{ARCH}\n" kernel | head -n1)
@mailinglists35
mailinglists35 / gradio-on-wsl
Last active February 3, 2019 20:21
How to run Gradio under WSL on windows 10 with pulseaudio for windows and MobaXterm
requirements:
mobaxterm
WSL
pulseaudio for windows
gradio fc29 rpm build
Setup and run pulseaudio https://token2shell.com/howto/x410/enabling-sound-in-wsl-ubuntu-let-it-sing/
quote:
download the linked zipfile containing preview binaries from https://www.freedesktop.org/wiki/Software/PulseAudio/Ports/Windows/Support/
@mailinglists35
mailinglists35 / zfs-veracrypt-failed-usb-cable.txt
Last active July 7, 2023 14:11
recover veracrypt zfs pool after failed usb cable, without reboot
********************************************************************************
WARNING THESE ARE MY PARTICULAR CASE NOTES MADE PUBLIC SO I CAN EASILY FIND THEM
DO NOT BLINDLY PASTE WITHOUT UNDERSTANDING WHAT DO THESE COMMANDS DO
********************************************************************************
dmsetup table | grep veracrypt
veracrypt2: 0 3904923136 crypt aes-xts-plain64 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 256 8:34 256
dmsetup reload veracrypt2 --table "0 3904923136 error"
@mailinglists35
mailinglists35 / block_dump
Created October 23, 2018 11:33
iotail echo 1 > /proc/sys/vm/block_dump
https://lxadm.com/Simple_filesystem_read/write_tracing_with_/proc/sys/vm/block_dump
@mailinglists35
mailinglists35 / ping@.service
Last active October 10, 2018 17:06 — forked from mosquito/pingd.service
Systemd ping daemon
[root@stage ~]# cat /etc/systemd/system/ping@.service
[Unit]
Description=One time ping check of host %I
After=network.target
[Service]
Type=forking #forking makes the unit stay in starting state until ping finishes. oneshot does not work with RemainAfterExit, while type simple makes the unit started as soon as ping starts, which is something we DON'T want
Restart=on-failure
ExecStart=/bin/ping -q -c 5 %i
RemainAfterExit=true
@mailinglists35
mailinglists35 / switch-hyper-threading
Created September 25, 2018 15:10 — forked from zuyu/switch-hyper-threading
Switch on / off hyper threading.
#!/bin/bash
typeset -i core_id
typeset -i sibling_id
typeset -i state
for i in /sys/devices/system/cpu/cpu[0-9]*; do
core_id="${i##*cpu}"
sibling_id="-1"
if [ -f ${i}/topology/thread_siblings_list ]; then
needs this too or else...
cd .../tpg1/acl
set attribute generate_node_acls=1
set attribute demo_mode_write_protect=0
#enable DISCARD
cd /backstores/...
set attribute emulate_tpws=1
set attribute emulate_tpu=1