Skip to content

Instantly share code, notes, and snippets.

View amenk's full-sized avatar

Alexander Menk amenk

View GitHub Profile
@amenk
amenk / robo
Last active August 19, 2017 09:34 — forked from caseyfw/robo
Bash auto completion for Robo taskrunner (with options) SCP compatible
#!/bin/sh
# see also https://stackoverflow.com/questions/39161770/symfony-based-autocomplete-breaks-scp-autocomplete
# define robo command
ROBO=robo
#ROBO=irobo
function __robo_list_cmds ()
{
@amenk
amenk / tvheadend-make-xbmc-iptv-m3ulist
Created April 30, 2017 12:59 — forked from dreamcat4/tvheadend-make-xbmc-iptv-m3ulist
tvheadend pids are BAD for .m3u file - do not use. Instead get .m3u file from official Inverto website.
#!/bin/sh
set -e # stop if any command returns a non-zero exit code
# #EXTM3U
# #EXTINF:-1 tvg-id="ARD.de" tvg-logo="ardhd" tvg-name="Das Erste HD" group-title="german",Das Erste HD
# http://192.168.0.3/?src=1&freq=11494&sr=22000&pol=h&msys=dvbs2&pids=0,5100,5101,5102,5103,5106
# #EXTINF:-1 tvg-id="ZDF.de" tvg-logo="zdfhd" tvg-name="ZDF HD" group-title="german",ZDF HD
# http://192.168.0.3/?src=1&freq=11362&sr=22000&pol=h&msys=dvbs2&pids=0,6100,6110,6120,6121,6123,6122
# #EXTINF:-1 tvg-id="RTL.de" tvg-logo="rtl" tvg-name="RTL Television" group-title="german",RTL Television
@amenk
amenk / somewhere.php
Last active October 16, 2015 15:17
Magento - Initialize an (empty) cart, generate shipping rates
/**
* Initialize an (empty) cart
*/
protected function initCart()
{
if (!$this->cart->getQuote()->getId()) {
$this->cart->getQuote()->getShippingAddress()
->setCountryId('DE')
->setCollectShippingRates(true)
->collectShippingRates();
@amenk
amenk / multiply.js
Last active October 12, 2015 20:53
Magento 2 Javascript Widget which multiplies two values and stores the result in a Bundle Option Quantity
/**
* Multiplies pages and copies and puts the result into the qty field
*/
define([
'jquery',
'underscore',
'mage/template',
], function ($, _, mageTemplate, utils) {
'use strict';
@amenk
amenk / .bashrc
Last active August 29, 2015 14:27
Bash Prompt
## Prompt
export PROMPT_COMMAND=__prompt_command # Func to gen PS1 after CMDs
function __prompt_command() {
local EXIT="$?" # This needs to be first
PS1=""
local RCol='\[\e[0m\]'
local Red='\[\e[0;31m\]'
@amenk
amenk / Activity.php
Last active August 29, 2015 14:23
Friendly Detail Page URLs in Laravel 5
class Activity extends Model
{
/**
* Convert a string to ASCII
*
* @source http://cubiq.org/the-perfect-php-clean-url-generator
* @param $str
* @param array $replace
* @param string $delimiter
@amenk
amenk / gaszaehler2.py
Created May 3, 2015 13:33
Metrix Gaszähler -> Volkszähler
import RPi.GPIO as GPIO
import time
from subprocess import call
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
# GPIO definieren
REED_gas = 3 # GPIO 3 (Pin 5)
GPIO.setup(REED_gas, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@amenk
amenk / gist:bf3abe8845a3218e4ddd
Created November 13, 2014 13:52
"Unlimited" Bash History with Time Stamps
HISTSIZE=1000000000
HISTFILESIZE=2000000000000000
HISTTIMEFORMAT="[%F %T %Z] "
@amenk
amenk / gist:68bd91e9dfc469891f1f
Created October 29, 2014 14:01
Make PHP Fatal Errors Clickable to Jump to the File in PHPStorm
xdebug.file_link_format="javascript:var rq = new XMLHttpRequest(); rq.open(\"GET\", \"http://localhost:8091?message=%f:%l\", true); rq.send(null);"
@amenk
amenk / connected-bx-sliders.js
Created September 25, 2014 14:32
Connected BXSliders
// connected sliders
sliders = [];
$('.bxslider-detail').each(function() {
sliders[$(this).attr('data-id')] = $(this).bxSlider({
mode: 'horizontal',
speed: 1000,
slideWidth: 400,
auto: true,
pager: false,
infiniteLoop: true