Skip to content

Instantly share code, notes, and snippets.

View Brainiarc7's full-sized avatar

Dennis E. Mungai Brainiarc7

View GitHub Profile
@Brainiarc7
Brainiarc7 / SCTE35 Decoder
Created July 7, 2017 14:12 — forked from alastairmccormack/SCTE35 Decoder
SCTE-35 Parser/Decoder in Python
#!/usr/bin/python
'''
SCTE-35 Decoder
The MIT License (MIT)
Copyright (c) 2014 Al McCormack
@Brainiarc7
Brainiarc7 / pitcairn_linux_clock_fix.md
Created June 25, 2017 02:01 — forked from Francesco149/pitcairn_linux_clock_fix.md
Gain massive GPU performance for Southern Islands AMD GPUs on Linux by removing DPM quirks in the kernel

Gain massive GPU performance for Southern Islands AMD GPUs on Linux by removing DPM quirks in the kernel

I recently found out that my r9 270x GPU was not hitting full clock speeds because it was being throttled by the kernel based on old bug reports on DPM stability. This was an easy fix on gentoo where recompiling the kernel is trivial, but on ubuntu and similar, rebuilding the kernel is not so straightforward, so here's a guide based on ubuntu 16.04 LTS. If you run gentoo or know what you're doing you can just skip to the relevant code.

On my r9 270x, this resulted in an overall improvement in frame-rates of up to 50%: Unigine Valley went from something like 30-40 fps average to 55-60 and osu! (running in wine) went from 0.33 ms (~3000fps) to 0.25ms (~4000fps).

Note that I'm no linux god and all this info was pieced together by googling and asking on forums (credits to the guys at phoronix for pointing me to the quirks code).

If you're using the proprietary amdgpu-pro driver, read until the end of the

<?php
/*
Made by Kudusch (blog.kudusch.de, kudusch.de, @Kudusch)
---------
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
@Brainiarc7
Brainiarc7 / htc_vive_watchman_codes
Created May 26, 2017 16:38 — forked from cnlohr/htc_vive_watchman_codes
HTC Vive Watchman Hacking Codes!
So, the way this goes is I post my AVR code, then I post what the HTC Vive does.
The output is: POST 0: (# of bytes) (IMU Timecode MSBs) (All raw light data)
(All raw light data ends with [3 bytes, LSB timecode] [OTA CRC (probably ignore)])
Events (TIME): (LED CODE 1)/(TIME CODE 1/TIMECODE 2)/(LED CODE 2)/(TIME CODE 3/TIMECODE 4)...
//NOTICE: The funky encoding of the numbers, and the fact that paramters are read from the end of the data going forward.
//We know we're done when the # of parameters read is (# of bytes left*2)-1
@Brainiarc7
Brainiarc7 / gpu-monitor.sh
Created March 31, 2017 22:05 — forked from disq/gpu-monitor.sh
GPU Monitor to send mail when load drops to 0%
#!/bin/sh
RET=`DISPLAY=:0 aticonfig --odgc --adapter=all`
ZEROCNT=`echo ${RET}|grep GPU|grep "0%"|wc -l`
if [ $ZEROCNT -gt 0 ]; then
if [ -e ~/gpu-monitor.stop ]; then
echo "$ZEROCNT gpu still idle"
exit 0
fi
sleep 10
RET=`DISPLAY=:0 aticonfig --odgc --adapter=all`
@Brainiarc7
Brainiarc7 / GoDaddySSLHAProxy.md
Created March 1, 2017 16:07 — forked from sethwebster/GoDaddySSLHAProxy.md
Creating a PEM for HaProxy from GoDaddy SSL Certificate

GoDaddy SSL Certificates PEM Creation for HaProxy (Ubuntu 14.04)

1 Acquire your SSL Certificate

Generate your CSR This generates a unique private key, skip this if you already have one.

sudo openssl genrsa -out  etc/ssl/yourdomain.com/yourdomain.com.key 1024

Next generate your CSR (Certificate Signing Request), required by GoDaddy:

@Brainiarc7
Brainiarc7 / interfaces
Created February 9, 2017 21:29 — forked from alandipert/interfaces
raspbian configuration for bridging eth0 and wlan0
# /etc/network/interfaces
# Configured for bridging wifi<->ethernet
# Tested with:
# - RPi Model B Rev. 1
# - 2013-02-09-wheezy-raspbian
# - Edimax 8192-series USB wireless adapter
# - /etc/modprobe.d/8192cu.conf contents:
# - options 8192cu rtw_power_mgnt=0 rtw_enusbss=0
# - firmware: c2d133fb4efe9c9995da7fd7e1c45d74254f5c4b
@Brainiarc7
Brainiarc7 / PathShortener.cmd
Created December 26, 2016 23:29
Windows Batch %PATH% Environment Variable Shortener and Checker
REM In a command shell save output to a text file
REM e.g. C:\Users\myname\Desktop\ PathShortener.cmd > output.txt
REM Review output, then replace current %PATH% variable
REM This handy script was found online, unfortunately the original
REM author isn't credited here.
@echo off
SET MyPath=%PATH%
echo %MyPath%
@Brainiarc7
Brainiarc7 / badips.sh
Created December 26, 2016 23:29
Script to add IPs from https://www.badips.com/ to iptables. It has an associated spinner function for user feedback. Be sure to mind / update your Paths as necessary.
#!/opt/bin/bash
# Script for blocking IPs which have been reported to www.badips.com
# Usage: Just execute by e.g. cron every day
# ---------------------------
_ipt=/sbin/iptables # Location of iptables (might be correct)
_input=badips.db # Name of database (will be downloaded with this name)
_pub_if=eth0 # Device which is connected to the internet (ex. $ifconfig for that)
_droplist=badip-droplist # Name of chain in iptables (Only change this if you have already a chain with this name)
_level=4 # Blog level: not so bad/false report (0) over confirmed bad (3) to quite aggressive (5) (see www.badips.com for that)
@Brainiarc7
Brainiarc7 / clearall.sh
Created December 26, 2016 23:29
Clear iptables
#!/bin/sh
echo "Stopping firewall and allowing everyone..."
iptables -F
iptables -X
iptables -t nat -F
iptables -t nat -X
iptables -t mangle -F
iptables -t mangle -X
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT