Skip to content

Instantly share code, notes, and snippets.

This gist is for my post: http://www.andretw.com/2013/07/using-celery-right-now-and-more-best-practices-1.html
This Gist is for my post: http://www.andretw.com/2013/10/What-you-should-know-before-using-DataTables.html
# yum list \*openssl\*
yum install -y openssl098e
yum install -y zlib
ln -s /usr/lib64/libssl.so.0.9.8e /usr/lib64/libssl.so.0.9.8
ln -s /usr/lib64/libcrypto.so.0.9.8e /usr/lib64/libcrypto.so.0.9.8
ln -s /lib64/libbz2.so.1 /lib64/libbz2.so.1.0
wget https://bitbucket.org/pypy/pypy/downloads/pypy-1.8-linux64.tar.bz2
tar -xf pypy-1.8-linux64.tar.bz2
cp -r pypy-1.8 /opt
ln -s /opt/pypy-1.8/bin/pypy /usr/local/bin
SomethingCtrl = ($scope, myService) ->
$scope.my_array = []
$scope.getList = () ->
# do something
$scope.my_array = myService.getItems() # return ['a'], ['a', 'b'] or ['a', 'b', 'c']
@andretw
andretw / change_all_tables_collation.sql
Last active August 29, 2015 13:58
SQL to select and change the collation from one to another. (utf8, for example.)
# ALTER DATABASE databasename CHARACTER SET utf8 COLLATE utf8_unicode_ci;
# ALTER TABLE tablename CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;
SELECT CONCAT("ALTER TABLE ",TABLE_SCHEMA,".",TABLE_NAME," CONVERT TO CHARACTER SET utf8 COLLATE utf8_unicode_ci;") AS alter_sql
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = 'cms';
from django.db.models import Q
tag_list = ['a', 'b', 'c']
q_objects = Q()
for t in tag_list:
# Use |= for 'or' &= for 'and'
q_objects &= Q(blogpost__keyword=t)
blog_posts = blog_posts.filter(q_objects)
@andretw
andretw / network_related.sh
Last active January 14, 2016 16:50
Network related for MacOS X
This Gist is for my post: http://www.andretw.com/2014/04/customize-your-mezzanine-with-Django-middleware-and-JavaScript-AngularJS-for-i18n-multilingual.html