Skip to content

Instantly share code, notes, and snippets.

🤓
Geek-mode Initialized

Daan van den Bergh Dan0sz

🤓
Geek-mode Initialized
Block or report user

Report or block Dan0sz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Dan0sz
Dan0sz / make-altinstall-python.sh
Created Oct 21, 2018
Install Python 2.7.x from Source with sqlite3 included
View make-altinstall-python.sh
# Prerequisites for Python 2.7.x
apt-get update
apt-get install build-essential checkinstall
apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
# Download and extract Python 2.7.13
cd /usr/src
curl -O https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
tar xvfz Python-2.7.13.tgz
@Dan0sz
Dan0sz / total-price-of-cart.php
Created Oct 21, 2018
Get Total Price of Cart Including/Excluding VAT/Tax in Magento Minicart Widget
View total-price-of-cart.php
<?php
// Get Price of all Items in Cart including VAT/Tax
Mage::helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getGrandTotal()
// Get Total Price excluding/without VAT/Tax
Mage::helper('checkout')->formatPrice(Mage::getSingleton('checkout/cart')->getQuote()->getSubtotal()
@Dan0sz
Dan0sz / disable-emojis.php
Last active Oct 21, 2018
Disable WP Emoji's
View disable-emojis.php
<?php
// Disable WP Emoji's
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
@Dan0sz
Dan0sz / text-overflow.php
Created Oct 21, 2018
Text-Overflow: Ellipsis with PHP
View text-overflow.php
<?php
$text = 'your text'; // or $yourtext;
$maxPos = 50; // Max. number of characters
if (strlen($text) > $maxPos)
{
$lastPos = ($maxPos - 3) - strlen($text);
$text = substr($text, 0, strrpos($text, ' ', $lastPos)) . '...';
}
echo $text;
@Dan0sz
Dan0sz / template-sharing-box.php
Created Oct 21, 2018
Pure PHP template for Facebook, Twitter and Google+ Share Buttons
View template-sharing-box.php
<?php
/* Social Share Buttons template for Wordpress
* By Daan van den Bergh
*/
$postUrl = 'http' . ( isset( $_SERVER['HTTPS'] ) ? 's' : '' ) . '://' . "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}"; ?>
<section class="sharing-box content-margin content-background clearfix">
<h5 class="sharing-box-name">Don't be selfish. Share the knowledge!</h5>
<div class="share-button-wrapper">
@Dan0sz
Dan0sz / apps.conf
Created Oct 21, 2018
Nginx configuration for reverse proxy for SABnzbd, Sonarr, Radarr and Transmission
View apps.conf
server_name nas.yourdomain.com 192.168.xxx.xxx;
location /sabnzbd {
proxy_pass https://localhost:9080/sabnzbd;
}
location /sonarr {
proxy_pass http://localhost:8989/sonarr;
}
@Dan0sz
Dan0sz / openmediavault-plex
Last active Oct 21, 2018
Nginx Server-block for Reverse Proxy for Plex in OpenMediaVault to place in /etc/nginx/sites-available/.
View openmediavault-plex
server {
listen [::]:443;
server_name plex.mydomain.com;
rewrite https://$host$request_uri? permanent;
error_log /var/log/nginx/openmediavault-plex_error.log error;
access_log /var/log/nginx/openmediavault-plex_access.log combined;
You can’t perform that action at this time.