Skip to content

Instantly share code, notes, and snippets.

View reitermarkus's full-sized avatar

Markus Reiter reitermarkus

View GitHub Profile
@reitermarkus
reitermarkus / time-based-css.php
Created November 5, 2012 15:18
Time-based css with javascript + php.
<!DOCTYPE html>
<html>
<head>
<style>
.night {
background: #000;
color: #fff;
}
</style>
</head>
  • led-wifi

    Service to show signal strength with LEDs.
    Copy to /etc/init.d, run chmod 0755 led-wifi, enable using /etc/init.d/led-wifi enable or LuCi.

  • poe-pt.sh

    Shell script to enable POE-Passthrough on the second ethernet port.
    Copy and paste into LuCi startup scripts.

@reitermarkus
reitermarkus / RE-BL X Commands.md
Last active August 29, 2015 14:22 — forked from anonymous/rebl.csv
HID Commands for RE-BL X (PS3)
We couldn’t find that file to show.
@reitermarkus
reitermarkus / assistive-access-el-capitan.py
Last active February 6, 2022 14:00
Scripts to enable Assistive Access programmatically on OS X El Capitan.
#!/usr/bin/python
# Grant Assistive Access to Terminal and “osascript”.
import sqlite3
conn = sqlite3.connect('/Library/Application Support/com.apple.TCC/TCC.db')
conn.cursor().execute("INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','com.apple.Terminal',0,1,1,NULL,NULL)")
conn.cursor().execute("INSERT or REPLACE INTO access VALUES('kTCCServiceAccessibility','$(which osascript)',1,1,1,NULL,NULL)")
conn.commit()
@reitermarkus
reitermarkus / autowake-install.sh
Last active October 10, 2015 17:34
OS X LaunchDaemon to automatically wake or boot your Mac every 15 minutes in case of a power failure – using pmset.
#!/bin/sh
launchd_name='com.apple.AutoWake'
launchd_plist=/Library/LaunchDaemons/"$launchd_name".plist
sudo dd of=$launchd_plist <<'EOF' &>/dev/null
<plist version="1.0"><dict><key>ProgramArguments</key><array><string>/bin/bash</string><string>-c</string><string>weekdays=MTWRFSU; eventtype=wakeorpoweron; sudo pmset repeat $eventtype $weekdays 05:30:00; for i in {0..23}; do seconds=`date +%s`; seconds=$(($seconds+(3600*$i))); hour=`date -r $seconds +'%m/%d/%y %H'`; minute=`date -r $seconds +%M`; for min in 00 15 30 45; do if [[ $i != 0 ]] || ([[ $i == 0 ]] &amp;&amp; [[ $minute -lt $min ]]); then if ! sudo pmset -g sched | grep $eventtype | grep -q "$hour:$min:00"; then sudo pmset schedule $eventtype "$hour:$min:00"; fi; fi; done; done</string></array></dict></plist>
EOF
sudo plutil -convert xml1 $launchd_plist
@reitermarkus
reitermarkus / digitalocean-centos-wordpress.sh
Last active April 24, 2019 05:28
Install WordPress on DigitalOcean CentOS Droplet with PHP 7
#!/bin/sh
DATABASE_NAME='wordpress'
DATABASE_USER='wordpress'
ROOT_MYSQL_PASSWORD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev`
WORDPRESS_MYSQL_PASSWORD=`dd if=/dev/urandom bs=1 count=32 2>/dev/null | base64 -w 0 | rev | cut -b 2- | rev`
# Write Passwords to File.
@reitermarkus
reitermarkus / bluetooth-audio.sh
Last active January 29, 2017 10:47
Raspberry Pi 3 A2DP Bluetooth Audio Receiver (Raspbian Jessie Lite)
#!/usr/bin/env sh
NAME="Fiat 500 L"
# Set Bluetooth Device Name
echo "PRETTY_HOSTNAME=\"${NAME}\"" | sudo tee /etc/machine-info
# Allow 'pi' user to change bluetooth settings.
sudo usermod -a -G lp pi
#!/usr/bin/env sh
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
yes | wget -q -O - razberry.z-wave.me/install | sudo bash
sudo apt-get install -y ruby
sudo gem install sinatra
sudo gem install pi_piper
@reitermarkus
reitermarkus / fire_tv_remote
Created July 15, 2016 21:19
Ruby script to control FireTVs.
#!/usr/bin/env ruby
class ConnectionError < StandardError; end
class AndroidDebugBridge
require 'open3'
EXECUTABLE = `which adb`.chomp
DEFAULT_PORT = 5555