Skip to content

Instantly share code, notes, and snippets.

@boombatower
boombatower / telegraf-smartctl
Created February 8, 2019 22:27
Wrapper script for smartctl to correct S.M.A.R.T. attribute values for Seagate drives.
#!/bin/bash
# Correct S.M.A.R.T. attribute values for Seagate drives
# https://serverfault.com/questions/313649/how-to-interpret-this-smartctl-smartmon-data
meta_value()
{
echo "$1" | grep -oP ":\s+\K.*"
}
correct_value()
@boombatower
boombatower / notify.js
Last active October 27, 2016 15:21
Play a notification sound whenever an Android IP Webcam motion sensor exceeds the threshold.
// Execute in developer console on /sensors.html.
var limit = document.getElementById('motion_limit').value;
var audio = new Audio('http://gabenewell.org/audio/gabenewellwatchingyou.mp3');
(function() {
var origOpen = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function() {
this.addEventListener('load', function() {
var response = JSON.parse(this.responseText);
for (var i = 0; i < response['motion']['data'].length; i++) {
@boombatower
boombatower / rebuild
Last active September 29, 2016 20:45
workaround for pmbs tmpdir issue
#!/bin/bash
# workaround for pmbs tmpdir issue
# usage:
# watch -n 60 -e ./rebuild Multimedia obs-studio
project=$1
package=$2
results=($(osc results $project $package))
# zypper se -ir packman
Loading repository data...
Reading installed packages...
S | Name | Summary | Type
@boombatower
boombatower / steam-clean.sh
Last active July 8, 2016 23:49
super ugly tweaked version from onlie
#!/bin/bash
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6-4.6-pic_4.6.3-1ubuntu5+srt4_amd64.md5
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/installed/libstdc++6_4.8.1-2ubuntu1~12.04+steamrt2+srt1_amd64.md5
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.a
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/gcc/x86_64-linux-gnu/4.6/libstdc++_pic.map
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6
rm ~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.18
From 150e9ee68ad703ef9ed264c1350392aa23d016b0 Mon Sep 17 00:00:00 2001
From: boombatower <[email protected]>
Date: Sun, 20 Mar 2016 23:48:20 -0500
Subject: [PATCH] Infer Composer meta information for internal Drupal git
repos.
---
src/Composer/Repository/Vcs/GitDriver.php | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff working copy against last commited version
Index: php5-pear-channel-doctrine.spec
===================================================================
--- php5-pear-channel-doctrine.spec (revision 1045b4b8fccebfa0b1801f45c66d3d3b)
+++ php5-pear-channel-doctrine.spec (working copy)
@@ -11,8 +11,8 @@
Source0: http://pear.doctrine-project.org/channel.xml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch
@boombatower
boombatower / g710+-leds.php
Created November 9, 2015 06:02
Cycle all leds on Logitech g710+ keyboard (demo: https://www.youtube.com/watch?v=XGil25Uhe_o)
<?php
while (true) {
for ($wasd = 0; $wasd < 5; $wasd++) {
for ($other = 0; $other < 5; $other++) {
file_put_contents('/sys/bus/hid/devices/0003:046D:C24D.0002/logitech-g710/led_keys', $wasd << 4 | $other);
usleep(100000);
}
}
@boombatower
boombatower / download.php
Created September 27, 2015 05:15
Web scraper for vbulletin. Create pdf of pages and whole thread and downloads all attached images.
<?php
const BASE = '';
const COUNT = 1;
$pages = [];
for ($i = 1; $i <= COUNT; $i++) {
$suffix = $i > 1 ? '/page' . $i : '';
$pages[] = $page = 'page' . $i . '.pdf';
$url = BASE . $suffix;
@boombatower
boombatower / Dockerfile
Last active January 30, 2020 16:29
obs-studio build dockerfile
FROM boombatower/opensuse
RUN zypper addrepo --no-gpgcheck \
http://packman.inode.at/suse/openSUSE_13.2/ packman && \
zypper mr -p 20 packman && \
zypper refresh
RUN zypper --non-interactive install --no-recommends \
cmake \
fontconfig-devel \