Skip to content

Instantly share code, notes, and snippets.

View hlfbt's full-sized avatar
🤔

Alexander Schulz hlfbt

🤔
View GitHub Profile
@hlfbt
hlfbt / twig-repl.php
Last active September 21, 2016 15:11 — forked from arnaud-lb/twig-repl.php
Twig REPL
<?php
/**
* Twig REPL hack
*
* Arnaud Le Blanc <arnaud.lb@gmail.com>
*/
require 'vendor/twig/twig/lib/Twig/Autoloader.php';
Twig_Autoloader::register();
@hlfbt
hlfbt / cache.js
Last active August 29, 2015 14:19
A simple cache for javascript. Useful to have a simple interface to share variables over between pageloads.
function Cache () {
"use strict";
if (this.constructor != Cache) throw new TypeError("Constructor Cache requires 'new'");
/*
A dumb, simple cache, to make access to cross-pageload variables easy and manageable.
All cache times are in milliseconds.
*/
var storage = window['localStorage'];
@hlfbt
hlfbt / select.js
Last active September 7, 2016 12:07
A stupid simple framework just like jquery that mainly grew out of procrastination. I use this wherever the jquery way is much more elegant/easier but there is no jquery available (i.e. in a userscript before the page completely loaded). May be expanded every now and then as I deem fit.
/*/
* This simulates JQuery's constructor functionality as best as easiest possible
* Some minor things that I never really use (like calling select() without arguments,
* or some ambiguous css paths not being interpreted by querySelectorAll correctly)
* might not really work, but I personally don't see much need to make it more complicated
* to work around them currently.
/*/
var select = function (s, c) {
if (!c || c == null)
c = document;
@hlfbt
hlfbt / ab_notifications.beta.user.js
Last active May 1, 2017 00:37
Shows toasty notifications for various things on AnimeBytes! See the comments for screenshots!
// ==UserScript==
// @name AnimeBytes Notifications
// @author potatoe
// @version 2.6.3.X.4.11
// @description AnimeBytes SUPER Notifications! super! s-...super..? || Shows toasty notifications for various things!
// @icon https://animebytes.tv/favicon.ico
// @include https://animebytes.tv/*
// @match https://animebytes.tv/*
// @downloadURL https://ab.nope.bz/userscripts/notifications/ab_notifications.beta.user.js
// @updateURL https://ab.nope.bz/userscripts/notifications/ab_notifications.beta.user.js
@hlfbt
hlfbt / n2dissite.sh
Created February 6, 2012 04:08
Nginx-to-ensite and Nginx-to-dissite - Two simple scripts that enable and disable Nginxs virtualhost VHOST. Adapt VHOSTEN and VHOSTAV accordingly, place in /usr/sbin and enjoy.
#!/bin/bash
# Author: Alexander Schulz
VHOSTEN="/etc/nginx/sites-enabled/"
if [[ $1 == "-h" ]] || [[ $1 == "--help" ]]
then
echo 'Usage: n2dissite VHOST'
echo 'Disables Nginxs virtualhost VHOST.'
@hlfbt
hlfbt / pythoneval.py
Created January 21, 2012 20:16 — forked from kylef/pyeval.py
Python Evaluate for ZNC modpython
# pythoneval.py
import sys
import re
from code import InteractiveInterpreter
import znc
class pythoneval(znc.Module, InteractiveInterpreter):
# module_types makes it unable to load