Skip to content

Instantly share code, notes, and snippets.

View mythmon's full-sized avatar

Michael Cooper mythmon

View GitHub Profile
@mythmon
mythmon / robot.js
Created December 6, 2012 04:35
Squiggleslashsrc
//FightCode can only understand your robot
//if its class is called Robot
var Robot = function(robot) {
};
Robot.prototype.onIdle = function(ev) {
var robot = ev.robot;
robot.ahead(3);
DIRNAME=foo
echo <<EOM
mkdir $DIRNAME
cd $DIRNAME
put *
exit
EOM | ftp server
UPDATE feedback_opinion SET created=date_add(created, interval 6 month) WHERE month(created) < 7 and year(created) = 2012;
#!/bin/bash
export LEEROY_URL="https://leeroybot.herokuapp.com/"
LEEROY_RERUN="https://raw.github.com/lonnen/leeroy-rerun/master/leeroy-rerun.py"
# Usage
[[ -z $1 ]] || [[ -z $2 ]] && {
echo "Rerun a Leeroy job for a Mozilla project."
echo -e " $ $(basename $0) PROJECT PULLNUM"
exit 1
I don't have a blog, so I'm going to rant here. tl;dr: Apple is being
evil, and reinterpreting court orders to their own benefit.
So for those of you who don't follow tech news, let me tell you
something about Apple. Recently, Apple and Samsung have been in legal
battles over the design of some Samsung tablets. Apple claimed that
Samsung was blatantly copying the iPad's design. There have been several
court cases in serveral countries over this matter, but today I am going
to tell you about on in the UK.
def detect_language(request):
"""
Pick a user's preferred language from their Accept-Language headers.
"""
accept = request.META.get('HTTP_ACCEPT_LANGUAGE')
if not accept:
return ''
ranked_languages = parse_accept_lang_header(accept)
for lang, q in ranked_languages:
$ make
Making all in src
make[1]: Entering directory `/home/mythmon/src/inputmo/sphinx/src'
if test -d ../.svn; then svn info .. --xml | perl svnxrev.pl; fi;
make all-am
make[2]: Entering directory `/home/mythmon/src/inputmo/sphinx/src'
g++ -DHAVE_CONFIG_H -I. -I../config -DSYSCONFDIR="\"/home/mythmon/src/inputmo/elasticsearch/etc\"" -I/usr/local/include -pthread -I/usr/include/mysql -fPIC -pipe -fstack-protector --param=ssp-buffer-size=4 -D_FORTIFY_SOURCE=2 -fno-strict-aliasing -DBIG_JOINS=1 -fomit-frame-pointer -g -Wall -g -D_FILE_OFFSET_BITS=64 -O3 -DNDEBUG -MT sphinxexpr.o -MD -MP -MF .deps/sphinxexpr.Tpo -c -o sphinxexpr.o sphinxexpr.cpp
sphinxexpr.cpp: In instantiation of ‘int Expr_In_c<T>::IntEval(const CSphMatch&) const [with T = float]’:
sphinxexpr.cpp:1739:1: required from here
sphinxexpr.cpp:1080:43: error: ‘ExprEval’ was not declared in this scope, and no declarations were found by argument-dependent lookup at the point of instantiation [-fpermissive]
@mythmon
mythmon / my.cnf
Created October 26, 2012 21:00
Snippet of my.cnf that makes tests 30% faster
# To my understanding, these settings make mysql slightly less durable/reliable, but in ways
# that don't really affect tests.
[mysqld]
# Don't flush log after transactions
innodb_flush_log_at_trx_commit = 0
# Don't sync binlog (it still gets written, but faster)
sync_binlog = 0
# Use a faster, less durable method to sync the DB.
innodb_flush_method = O_DIRECT
@import "defaults.css";
body {
background: #111;
padding: 5px;
max-width: 480px;
}
.screen {
height: 100px;
>>> for h in range(24):
... s = models.Simple(prodchan='firefox.desktop.stable', happy=True, description='Test of datetime splitting (%d)' % h, created=datetime(2012, 10, 21, h, 0))
... s.save()
... models.SimpleIndex.index(models.SimpleIndex.extract_document(s.id), s.id)