Skip to content

Instantly share code, notes, and snippets.

View cybrox's full-sized avatar
☠️
Tinkering

Sven Gehring cybrox

☠️
Tinkering
View GitHub Profile
@cybrox
cybrox / gmusic_small_songlist.js
Created January 28, 2016 07:58
Extract song titles from the google music mini player
var songString = "";
var songEntries = document.getElementsByClassName('song-row');
for (var i = 0; i < songEntries.length; i++) {
var song = songEntries[i];
for (var j = 0; j < song.childNodes.length; j++) {
if (song.childNodes[j].getAttribute('data-col') == 'song-details') {
var col = song.childNodes[j].childNodes[2].childNodes[1];
songString += col.childNodes[1].childNodes[0].innerText + ' - ';
songString += col.childNodes[0].innerText + '\n';
}

Keybase proof

I hereby claim:

  • I am cybrox on github.
  • I am cybrox (https://keybase.io/cybrox) on keybase.
  • I have a public key whose fingerprint is 78B4 EDFE 2BB7 65C3 C20C 53F9 D77D 7C1A 1174 9A45

To claim this, I am signing this object:

@cybrox
cybrox / power-monitor.lua
Created September 18, 2016 20:14
Mekanism Induction Matrix Computer Craft Stats Display
-- Power Monitor for induction matrix
--
-- Written and copyrighted 2016+
-- by Sven Marc 'cybrox' Gehring
-- Licensed under MIT license
-- Printing right aligned text on a line
@cybrox
cybrox / hummingbird-legacy.md
Created October 12, 2016 07:10
Really outdated hb legacy install methods

This page exists to document old methods for installing Hummingbird. These instructions are not recommended in any case. Use Docker instead.

OS X

  1. Install Homebrew
  2. Install Ruby 2.1.3 (we recommend using RVM)
  3. Install the following packages from homebrew: curl, v8, redis, imagemagick, and node
  4. Install Postgres.app
  5. Jump to "General Instructions"
@cybrox
cybrox / vptracer.js
Created December 17, 2016 17:08
Find elements stretching viewport
const viewport = Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
const possibleCauses = [];
console.log(`Looking for elements outside viewport width ${viewport}px...`);
[...document.getElementsByTagName('*')].forEach((element, index) => {
const limit = element.getBoundingClientRect().right;
const style = window.getComputedStyle(element);
if (limit <= viewport) return;
if (style.display === 'none') return;
if (style.visibility === 'hidden') return;
@cybrox
cybrox / mjpegstream.swift
Last active March 29, 2019 13:40
Proof-of-concept manual mjpeg-stream swift implementation
// Created by Sven Gehring on 09/01/17.
//
// Licensed under MIT license. Feel free to use in any way
//
// Please note: This is merely a proof of concept that is very
// incomplete overall. Its protocols are not even implement. The
// main purpose was just to figure out how hard and performance-
// intense this manual approach would be.
//
// Spoiler: Just letting WebKit do the work is easier on the battery,
@cybrox
cybrox / cformatter.js
Created February 23, 2017 12:25
Rudimentary C format correcter written in Javascript
<!DOCTYPE html>
<html>
<head>
<title>C Formatter</title>
</head>
<body>
<textarea id="in" placeholder="IN" rows="10"></textarea>
<textarea id="out" placeholder="OUT" rows="10"></textarea>
<button id="go">GO</button>
<script type="text/javascript">
@cybrox
cybrox / version_builder.exs
Last active June 15, 2017 09:11
Distillery pseudo-plugin for appending git revision and branch (if not master) to a release version
defmodule VersionBuilder do
@doc """
Returns the current git info, consisting of the current revision and
the current branch, if it should differ from being "master"
"""
def git_info do
"#{git_revision()}#{git_branch()}"
end
@cybrox
cybrox / clean-docker.sh
Created June 8, 2018 08:03
Reclaim Disk Space from Docker
docker rm -v $(docker ps -f status=dead -f status=exited -aq)
docker rmi $(docker images --no-trunc -qf dangling=true)
docker volume rm $(docker volume ls -qf dangling=true)
@cybrox
cybrox / testing-protected-phoenix-controllers-1.ex
Created July 15, 2018 13:31
Blog: Testing Protected Phoenix Controllers - Snippet 1
def authenticate_user_token(conn, _opts) do
with ["Bearer " <> token] <- get_req_header(conn, "authorization"),
{:ok, %{:id => user_id}} <- Token.verify_user_for_token(token),
conn_assign_user_details(conn, user_id)
else
_ -> send_unauthorized_if_not_faked(conn)
end
end