(C-x means ctrl+x, M-x means alt+x)
The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:
| """ | |
| Copyright (c) 2009, Sean Creeley | |
| All rights reserved. | |
| Redistribution and use in source and binary forms, with or without modification, | |
| are permitted provided that the following conditions are met: | |
| * Redistributions of source code must retain the above copyright notice, this | |
| list of conditions and the following disclaimer. | |
| * Redistributions in binary form must reproduce the above copyright notice, |
| """ | |
| A decorator for management commands (or any class method) to ensure that there is | |
| only ever one process running the method at any one time. | |
| Requires lockfile - (pip install lockfile) | |
| Author: Ross Lawley | |
| """ | |
| import time |
| CREATE TABLE IF NOT EXISTS `country` ( | |
| `id` int(11) NOT NULL AUTO_INCREMENT, | |
| `iso` char(2) NOT NULL, | |
| `name` varchar(80) NOT NULL, | |
| `nicename` varchar(80) NOT NULL, | |
| `iso3` char(3) DEFAULT NULL, | |
| `numcode` smallint(6) DEFAULT NULL, | |
| `phonecode` int(5) NOT NULL, | |
| PRIMARY KEY (`id`) | |
| ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; |
| # Copyright (c) 2012, Ryan Gomba | |
| # All rights reserved. | |
| # | |
| # Redistribution and use in source and binary forms, with or without | |
| # modification, are permitted provided that the following conditions are met: | |
| # | |
| # 1. Redistributions of source code must retain the above copyright notice, this | |
| # list of conditions and the following disclaimer. | |
| # 2. Redistributions in binary form must reproduce the above copyright notice, | |
| # this list of conditions and the following disclaimer in the documentation |
| """ | |
| realertime.lib.spawn | |
| ~~~~~~~~~~~~~~~~~~~~ | |
| :author: Adam Hitchcock | |
| :copyright: (c) 2012 DISQUS. | |
| :license: Apache License 2.0, see LICENSE for more details. | |
| """ | |
| from __future__ import absolute_import |
| -- show running queries (pre 9.2) | |
| SELECT procpid, age(clock_timestamp(), query_start), usename, current_query | |
| FROM pg_stat_activity | |
| WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
| ORDER BY query_start desc; | |
| -- show running queries (9.2) | |
| SELECT pid, age(clock_timestamp(), query_start), usename, query | |
| FROM pg_stat_activity | |
| WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
| #!/usr/bin/env python | |
| # http://www.rabbitmq.com/tutorials/tutorial-two-python.html | |
| import pika | |
| import sys | |
| connection = pika.BlockingConnection(pika.ConnectionParameters( | |
| host='localhost')) | |
| channel = connection.channel() | |
| message = ' '.join(sys.argv[1:]) or "Hello World!" |
| import logging | |
| import pika | |
| from threading import Timer | |
| BATCH_SIZE = 100 | |
| LOG_FORMAT = ('%(levelname) -10s %(asctime)s %(name) -30s %(funcName) ' | |
| '-35s %(lineno) -5d: %(message)s') | |
| LOGGER = logging.getLogger(__name__) | |