Skip to content

Instantly share code, notes, and snippets.

View timani's full-sized avatar

Timani Tunduwani timani

View GitHub Profile
@timani
timani / gist:1474970
Created December 14, 2011 02:27
The best .emacs file
(custom-set-variables
;; custom-set-variables was added by Custom.
;; If you edit it by hand, you could mess it up, so be careful.
;; Your init file should contain only one such instance.
;; If there is more than one, they won't work right.
'(android-mode-sdk-dir "~/Library/android/android-sdk-linux_x86")
'(confirm-kill-emacs (quote y-or-n-p))
'(cua-mode t nil (cua-base))
'(ecb-options-version "2.40")
@timani
timani / gunzip_db
Created December 15, 2011 23:41
Import or restore a compressed .gz mysql DB
gunzip < db_name.gz | mysql -u root -p db_name
@timani
timani / fbss2fb.module
Created December 15, 2011 23:53
Use the open graph API to post to the Drupal Facebook style status (FBSS) module
<?php
/**
* @file
* Allows posting statuses from Drupal to Facebook.
*
*/
/**
* Implementation of hook_menu().
*/
@timani
timani / mod_pything_vs_mod_pjp_wsgi
Created July 18, 2012 04:41
mod_python is not mod_php vs WSGI
Unlike the PHP interpreter, the Python interpreter uses caching when executing files, so changes to a file will require the web server to be restarted.
Another problem is the basic concept – Apache starts child processes to handle the requests, and unfortunately every child process needs to load the whole Python interpreter even if it does not use it.
This makes the whole web server slower. Another problem is that, because mod_python is linked against a specific version of libpython, it is not possible to switch from an older version to a newer (e.g. 2.4 to 2.5) without recompiling mod_python.
mod_python is also bound to the Apache web server, so programs written for mod_python cannot easily run on other web servers.
These are the reasons why mod_python should be avoided when writing new programs. In some circumstances it still might be a good idea to use mod_python for deployment, but WSGI makes it possible to run WSGI programs under mod_python as well.
@timani
timani / wp-config.php
Last active December 10, 2015 22:58 — forked from nstielau/wp-config.php
A wp-config.php file Pantheon and local development
<?php
if (isset($_SERVER['PANTHEON_ENVIRONMENT'])) {
// Tweak #1
// Load database settings from PRESSFLOW_SETTINGS environment variable...
$pressflow_settings = json_decode($_SERVER['PRESSFLOW_SETTINGS'], TRUE);
$database_settings = $pressflow_settings['databases']['default']['default'];
$wp_upload_url = "/srv/bindings/" . $pressflow_settings['conf']['pantheon_binding'] . "/files";
/** MySQL configs */
@timani
timani / .gitignore
Created January 12, 2013 04:24
Default .gitignore file for Pantheon. This should prevent the wp-content/uploads directory from being committed to git. It is important to create the wp-content/uploads and create the symlink.
# Ignore paths that contain user-generated content.
/sites/*/files
/sites/*/private
/files/*
/cache
# ** Only works in OSs that support newer versions of fnmatch (Bash 4+)
/sites/default/**/files
/sites/default/**/private
@timani
timani / ini_set memory limit test
Last active December 11, 2015 07:49
memory limit ini_set
## debug file test.php
<?php
echo 'Memory limit before = ' . ini_get('memory_limit') . "<br />";
ini_set('memory_limit', '321M');
echo 'Memory limit after = ' . ini_get('memory_limit');
$ sudo /etc/init.d/php5-fpm restart
* Restarting PHP5 FastCGI Process Manager php5-fpm
@timani
timani / Simple pretty one line git log
Created May 8, 2013 19:56
Simple pretty one line git log
$ git log --pretty=oneline
3388257f9f8969393d5eba065b7afdd6bdda64c5 HotFixin'
bd4ddb9758b17561437cd4f4eb94c2202d9a425d Remove old redirect from testing empire
701d73e1d3d300961e5effb1ecbc5d1a38deaeb0 Adding Redis
4e94579a9aaa3bf90be5c8c7237c3fe36486ab58 Bue Editor
a5d975c5a96bb0ca3198162a1c6ac27fe501bedc Merge branch 'master' of https://github
26a70bc6df6c7c224bdf9691840acedbdb445ecc Ray said i should commit!
bbe775e4c21678fa8006dd6d7801a6feea8b0bfd Additional changes for plup and pluploa
9d7600fad757b044e456d05b687f43235216e40b Changes
@timani
timani / Drupal redis cache
Created May 26, 2013 20:50
Debugging bottlenecks in redis using the SLOWLOG command to find slow queries. http://redis.io/commands/slowlog
redis 50.56.88.48:10472> slowlog len
(integer) 64
redis 50.56.88.48:10472> slowlog get 10
1) 1) (integer) 14856
2) (integer) 1369600627
3) (integer) 15607
4) 1) "KEYS"
2) "pantheon-rediscache_ctools:35:*"
2) 1) (integer) 14855
2) (integer) 1369597346