Skip to content

Instantly share code, notes, and snippets.

View return1's full-sized avatar

Dominique Lederer return1

View GitHub Profile
return1 /
Created November 7, 2012 13:29
Analyze and tweak your apache2 mpm settings
# Copyright Erik Jacobson -
use warnings; use strict;
use Statistics::Descriptive;
my $webuser = 'www-data'; # The user your apache children run as. I ignore the root process.
my $command = 'apache2'; # The name of your processes as they appear to the "top" command.
my @top = `top -bn1`;
return1 / jquery-ad-iframe-resize.js
Created November 7, 2012 16:20
resize ad iframes by its content (ugly)
//auto-resizing ad-banners
var resizeInterval = window.setInterval(function () {
$iframe = $('#bigbanner iframe');
$iframe.attr('width', '100%').attr('height', '100%'); //reset
$doc = $($iframe.get(0).contentWindow.document);
$iframe.attr('width', $doc.width()).attr('height', $doc.height());
}, 1000);
return1 / Controller.php
Created November 7, 2012 16:24
Integration of Doctrine2 and Zend Framework
class IndexController extends Zend_Controller_Action {
public function init() {
$this->_em = Zend_Registry::get('entitymanager');
public function indexAction() {
$test = new Application_Model_Test();
$test->name = 'Test';
return1 / trim_enabler.txt
Last active May 26, 2024 11:01
TRIM Enabler for OS X Yosemite 10.10.3
# UPDATE for 10.10.4+: please consider this patch obsolete, as apple provides a tool called "trimforce" to enable trim support for 3rd party SSDs
# just run "sudo trimforce enable" to activate the trim support from now on!
# Original version by Grant Parnell is offline (
# Update July 2014: no longer offline, see
# Looks for "Apple" string in HD kext, changes it to a wildcard match for anything
# Alternative to
return1 / gist:5059418
Created February 28, 2013 19:36
S3/Cloudfront CORS (Cross-Origin Resource Sharing) Configuration for Webfonts in Firefox. make sure to redistribute Cloudfront after applying this config to the S3 bucket. Also you should restrict the origin to you domain, just to be safe.
<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="">
return1 /
Last active July 8, 2024 19:21
install a bitcoin cpuminer on ubuntu/debian
# install dependencies
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm
# clone cpuminer
git clone
# compile
cd cpuminer
./configure CFLAGS="-O3"
return1 / gist:5916637
Created July 3, 2013 09:29
return a 1px transparent gif with flask
def gif():
gif_str = base64.b64decode(gif)
return send_file(io.BytesIO(gif_str), mimetype='image/gif')
return1 /
Last active October 16, 2015 13:37
TRIM Enabler for OS X Yosemite 10.10.4+
sudo trimforce enable
return1 / gist:e957dbbe01218bcad677
Created October 20, 2015 12:42 — forked from douglasjarquin/gist:2208690
Amazon RDS Performance Tuning Settings
rds-modify-db-parameter-group {param-group-name} \
--parameters="name=character_set_server, value=utf8, method=pending-reboot" \
--parameters="name=collation_server, value=utf8_general_ci, method=pending-reboot" \
--parameters="name=tmp_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=max_heap_table_size, value={DBInstanceClassMemory/16}, method=pending-reboot" \
--parameters="name=query_cache_type, value=1, method=pending-reboot" \
--parameters="name=query_cache_size, value=131072, method=pending-reboot" \
--parameters="name=table_open_cache, value=2500, method=pending-reboot" \
--parameters="name=join_buffer_size, value={DBInstanceClassMemory/64}, method=pending-reboot" \
--parameters="name=thread_cache_size, value={DBInstanceClassMemory/12582880}, method=pending-reboot" \
return1 / letsencrypt-nginx.txt
Last active August 9, 2016 14:09
Letsencrypt Certbot New Certificate for Nginx
# from
# add to nginx server config
location ~ /.well-known {
root /usr/share/nginx/html;
allow all;
ssl_certificate_key /etc/letsencrypt/live/;
ssl_certificate /etc/letsencrypt/live/;