Skip to content

Instantly share code, notes, and snippets.

@skyhisi
skyhisi / qt-xinclude-processor.cpp
Created September 29, 2013 20:01
Basic XInclude processor written using Qt QXmlStreamReader/QXmlStreamWriter
#include <QtCore>
int main(int argc, char** argv)
{
QCoreApplication app(argc, argv);
if (argc < 2)
{
qDebug() << "Usage:" << argv[0] << "INFILE OUTFILE";
return 1;
@skyhisi
skyhisi / makefilegraph.py
Created August 6, 2019 12:06
Makefile Graph
#!/usr/bin/python
import argparse
import os.path
from cStringIO import StringIO
import subprocess
import sys
parser = argparse.ArgumentParser(description="Create a graphviz file of a makefile")
parser.add_argument("-C", "--directory", metavar="DIR", help="Change to directory DIR before reading the makefiles")
@skyhisi
skyhisi / pgkill.sh
Created August 6, 2019 12:11
Script to kill postgres workers for a given process
#!/bin/bash
PGPORT=5678
APP_PID=$(pidof -s $1)
if [ $? -ne "0" ]
then
echo "Can not find PID of $1"
exit 1
fi
@skyhisi
skyhisi / example.mk
Created August 6, 2019 12:13
Enable strict flags in a makefile for specific files
# Enable very strict flags for some files to ensure compatibility with
# all compilers (enables C99 strict compliance mode and more warnings).
STRICTFLAGS := \
-D_XOPEN_SOURCE --std=c99 -pedantic-errors -W -Wall -Wextra \
-Wno-variadic-macros -Wno-overlength-strings -fdiagnostics-show-option
STRICTFLAGS_FILES := \
file_a.c \
file_b.c
# Use '=' not ':=' to create a makefile macro
@skyhisi
skyhisi / vbox-compact-all.sh
Created August 6, 2019 12:15
Virtual Box - Compact all disks
#!/bin/bash
for ID in $(vboxmanage list hdds | grep '^UUID:' | cut -c14-)
do
vboxmanage modifyhd $ID --compact
done
@skyhisi
skyhisi / vlc-udp-stream.sh
Created August 6, 2019 12:17
VLC Ouput UDP Multicast Stream
#!/bin/bash
cvlc "$1" \
--sout='#udp{dst=239.1.1.170:1234}' \
--no-sout-rtp-sap \
--no-sout-standard-sap \
--sout-all --ttl=1 --sout-keep --loop
@skyhisi
skyhisi / qtlogging.ini
Created August 6, 2019 12:20
Qt - Enable qDebug on Fedora - /etc/xdg/QtProject/qtlogging.ini
[Rules]
*.debug=true
qt.*.debug=false
@skyhisi
skyhisi / confluence-uncheck-all.html
Created August 6, 2019 12:39
Create button to untick all check boxes
<button id="uncheckAll">Uncheck All</button>
<script type="text/javascript">
$('#uncheckAll').click(function(){$('.inline-task-list li.checked').each(function(i,e){ev = jQuery.Event("click"); ev.target = ev. currentTarget = e; ev.offsetX = ev.offsetY = 10; $(e).trigger(ev);});});
</script>
@skyhisi
skyhisi / fping-lan.service
Created November 14, 2019 10:23
Run fping as a systemd service, get network stats and keeps powerline/homeplug network adapters connected
[Unit]
Description=FPing LAN
After=network.target auditd.service time-sync.target
[Service]
ExecStart=/usr/bin/fping \
--loop --period=1000 --timeout=500 --squiet=1800 \
192.168.0.1 \
192.168.0.2
@skyhisi
skyhisi / alignment.c
Created August 25, 2020 08:01
Enable Alignment Checks on x86-64
void enable_ac(void)
{
__asm__("pushf\n"
"orl $0x40000, (%rsp)\n"
"popf");
}