Skip to content

Instantly share code, notes, and snippets.

View ePirat's full-sized avatar

Marvin Scholz ePirat

View GitHub Profile
@simonlk
simonlk / Woocommerce - show empty categories
Created October 21, 2012 06:33
Show empty categories within Woocommerce. Paste this in to your theme's functions file. It's just a copy and paste of a function within woocommerce-template.php and changing value of hide_empty to 0
// Paste this in to your theme's functions file
// Redefine sub category display to output empty categories
function woocommerce_product_subcategories( $args = array() ) {
global $woocommerce, $wp_query, $_chosen_attributes;
$defaults = array(
'before' => '',
'after' => '',
'force_display' => false
);
@scy
scy / opening-and-closing-an-ssh-tunnel-in-a-shell-script-the-smart-way.md
Last active March 15, 2024 11:26
Opening and closing an SSH tunnel in a shell script the smart way

Opening and closing an SSH tunnel in a shell script the smart way

I recently had the following problem:

  • From an unattended shell script (called by Jenkins), run a command-line tool that accesses the MySQL database on another host.
  • That tool doesn't know that the database is on another host, plus the MySQL port on that host is firewalled and not accessible from other machines.

We didn't want to open the MySQL port to the network, but it's possible to SSH from the Jenkins machine to the MySQL machine. So, basically you would do something like

ssh -L 3306:localhost:3306 remotehost

#!/usr/bin/ruby
# Create display override file to force Mac OS X to use RGB mode for Display
# see http://embdev.net/topic/284710
require 'base64'
data=`ioreg -l -d0 -w 0 -r -c AppleDisplay`
edids=data.scan(/IODisplayEDID.*?<([a-z0-9]+)>/i).flatten
vendorids=data.scan(/DisplayVendorID.*?([0-9]+)/i).flatten
@roxlu
roxlu / H264_Decoder.cpp
Created March 3, 2014 16:57
LibAV parser and decoder example with openGL (YUV420 -> RGB shader).
#include "H264_Decoder.h"
H264_Decoder::H264_Decoder(h264_decoder_callback frameCallback, void* user)
:codec(NULL)
,codec_context(NULL)
,parser(NULL)
,fp(NULL)
,frame(0)
,cb_frame(frameCallback)
,cb_user(user)
@Drakulix
Drakulix / mingw-w64-3.10-osx10.9.sh
Last active January 9, 2020 11:49
Script to install a Mingw-w64 Cross-Compiler Suite on Mac OS X 10.9
#!/bin/sh
# dependencies
echo "Installing dependencies via Homebrew (http://brew.sh)"
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
brew update
brew install gcc48
@ePirat
ePirat / CodeStyle.md
Last active August 29, 2015 14:07
C Coding Style proposal for Icecast

C Coding Style

Proposal for Icecast

Formatting

Indent with (4) spaces, no tabs.
A Line Should Not Exceed 80 Characters.

Brace Placement

All if, while, for and do statements should either have braces or be on a single line. Do not put parens next to keywords. Put a space between.

@Odie
Odie / gist:e26bc299bfc1f020e636
Created October 9, 2014 12:10
Parse user friendly time duration string in Swift
import UIKit
extension NSDateComponents {
subscript(unit: String) -> Int {
get {
switch unit{
case "month":
return self.month
case "day":
return self.day
@ePirat
ePirat / spec.md
Last active April 22, 2024 06:44
Icecast Protocol specification

Icecast protocol specification

What is the Icecast protocol?

When speaking of the Icecast protocol here, actually it's just the HTTP protocol, and this document will explain further how source clients need to send data to Icecast.

HTTP PUT based protocol

Since Icecast version 2.4.0 there is support for the standard HTTP PUT method. The mountpoint to which to send the data is specified by the URL path.

anonymous
anonymous / .css
Created February 5, 2016 16:40
abbr[title],
acronym[title],
dfn[title] {
border-bottom: 1px dotted #000;
}
@supports (text-decoration: dotted underline) {
abbr[title],
acronym[title],
dfn[title] {
text-decoration: dotted underline;
@ePirat
ePirat / INSTALL.md
Last active April 7, 2023 13:43
Cross-compile libaacs for Windows (64bit)

Cross-compile libaacs for Windows (64bit)

For this guide the ubuntu:yakkety Docker image was used.

Install the cross-compile toolchain

apt-get install mingw-w64-tools gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 wget gettext bison flex