Skip to content

Instantly share code, notes, and snippets.

View ksysctl's full-sized avatar
🏠
Working from home

Moises Brenes ksysctl

🏠
Working from home
View GitHub Profile
@ksysctl
ksysctl / settings.py
Created January 31, 2012 01:38
Hack to get around circular imports in django-haystack
SKIP_COMMANDS = [
'migrate',
'syncdb',
]
if any([command in sys.argv for command in SKIP_COMMANDS]):
HAYSTACK_ENABLE_REGISTRATIONS = False
@ksysctl
ksysctl / android-install-busybox
Created February 12, 2012 03:56
Install busybox on HTC Desire with Android 2.2
Connect HTC Desire via USB cable.
Make sure USB debugging is enabled.
$ cd /path/to/android/sdk/tools
$ adb push busybox /sdcard/busybox
$ adb reboot recovery
The phone should restart in recovery mode.
$ adb shell
@ksysctl
ksysctl / .gitconfig
Created February 22, 2012 22:01
My personal git configuration
[user]
name = Moises Brenes
email = moises.brenes@gmail.com
[color]
ui = auto
[core]
excludesfile = /home/gin/Projects/weird/.gitignore
editor = vim
@ksysctl
ksysctl / fix-admin-media.sh
Created April 27, 2012 20:16
Create an symbolic link on Openshift to retrieve static admin media
DJANGO_VERSION=1.4;
cd ${OPENSHIFT_REPO_DIR}/wsgi/static;
ln -s ${OPENSHIFT_GEAR_DIR}/virtenv/lib/${OPENSHIFT_GEAR_TYPE}/site-packages/Django-${DJANGO_VERSION}-py2.6.egg/django/contrib/admin/static/admin/ admin;
exit;
@ksysctl
ksysctl / create-django-admin.sh
Created April 30, 2012 18:22
Create a django admin on Openshift
ssh $youruuid@vendejo-$yournamespace.rhcloud.com
source $OPENSHIFT_GEAR_DIR/virtenv/bin/activate
python $OPENSHIFT_REPO_DIR/wsgi/openshift/manage.py createsuperuser
@ksysctl
ksysctl / trim.sh
Created May 8, 2012 03:01
Remove spaces, sample fuction usign bash shell
#!/bin/bash
# original string, with spaces
my_var=" Fuck You! . ";
echo $my_var;
# the function
function trim() {
local string=$@;
string=${string//[[:space:]]};
@ksysctl
ksysctl / cobject.py
Created May 25, 2012 00:30
Convert <dict, list, tuple> to object
# -*- coding: utf-8 -*-
class CObject(object):
def __init__(self, map):
if isinstance(map, (list, tuple)):
map = dict(enumerate(map))
if isinstance(map, dict):
for key, val in map.iteritems():
key = str(key)
@ksysctl
ksysctl / sources.list
Created July 26, 2012 18:13
Debian source list
# Testing
deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free
# Stable
# deb http://ftp.us.debian.org/debian/ stable main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ stable main contrib non-free
# Security
deb http://security.debian.org/ testing/updates main contrib non-free
@ksysctl
ksysctl / gist:3912493
Created October 18, 2012 15:18
Get octal permissions
stat --format=%a path/file
@ksysctl
ksysctl / gist:3955514
Created October 25, 2012 21:25
Magento
PHP Extensions "0" must be loaded.
http://www.magentocommerce.com/boards/viewthread/284882/#t410289
The problem seems to be in wrong version PHP SimpleXML extension. Here’s another workaround:
Replace in file app/code/core/Mage/Install/etc/config.xml (near 71th string) this
<extensions>
<pdo_mysql/>
</extensions>