This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Cache_Redis { | |
private $_cache; | |
private $_db; | |
private $_tag; | |
private $_key; | |
private $_get; | |
private $_set; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.py | |
api/ | |
__init__.py | |
models/ | |
__init__.py | |
ffxi.py | |
ffxiv.py | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
redis-benchmark -q -n 100000 | |
## Digital Ocean $5/month | |
1core, 512MB RAM | |
PING (inline): 46403.71 requests per second | |
PING: 51759.83 requests per second | |
MSET (10 keys): 28465.70 requests per second | |
SET: 53475.94 requests per second | |
GET: 51921.08 requests per second |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Command: | |
for i in 1 2 3; do hdparm -tT /dev/sda1; done | |
Softlayer Config | |
2x300GB 15k RPM SAS HW-RAID1 | |
/dev/sda6: | |
Timing cached reads: 24714 MB in 2.00 seconds = 12371.67 MB/sec | |
Timing buffered disk reads: 916 MB in 3.04 seconds = 301.20 MB/sec |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
set_include_path('/usr/share/php/libzend-framework-php/'. PATH_SEPARATOR . "."); | |
function __autoload($className) { | |
require $className = str_replace('_', '/', $className) . '.php'; | |
} | |
$db = new Zend_Db_Adapter_Mysqli(array('host'=>'localhost', 'username'=>'', 'password'=>'', 'dbname'=>'')); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
import brukva | |
import json | |
import phpserialize | |
from tornado import web | |
from tornadio2 import SocketConnection, TornadioRouter, event, SocketServer | |
c = brukva.Client() | |
c.connect() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 355, in _handle_read | |
if self._read_to_buffer() == 0: | |
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 422, in _read_to_buffer | |
chunk = self._read_from_socket() | |
File "/usr/local/lib/python2.7/dist-packages/tornado/iostream.py", line 403, in _read_from_socket | |
chunk = self.socket.recv(self.read_chunk_size) | |
error: [Errno 104] Connection reset by peer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Traceback (most recent call last): | |
File "/usr/local/lib/pypy2.7/dist-packages/tornado/iostream.py", line 355, in _handle_read | |
if self._read_to_buffer() == 0: | |
File "/usr/local/lib/pypy2.7/dist-packages/tornado/iostream.py", line 422, in _read_to_buffer | |
chunk = self._read_from_socket() | |
File "/usr/local/lib/pypy2.7/dist-packages/tornado/iostream.py", line 403, in _read_from_socket | |
chunk = self.socket.recv(self.read_chunk_size) | |
File "/usr/lib/pypy/lib-python/modified-2.7/socket.py", line 188, in recv | |
return self._sock.recv(buffersize, flags=flags) | |
error: [Errno 104] Connection reset by peer |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def _time_independent_equals(a, b): | |
if len(a) != len(b): | |
return False | |
result = 0 | |
if type(a[0]) is int: # python3 byte strings | |
for x, y in zip(a, b): | |
result |= x ^ y | |
else: # python2 | |
for x, y in zip(a, b): | |
result |= ord(x) ^ ord(y) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Python Version: https://gist.github.com/3738771 */ | |
function _time_independent_equals($a, $b){ | |
if (strlen($a) !== strlen($b)){ | |
return; | |
} | |
$result = 0; | |
for($i=0; $i<strlen($a); $i++){ |
OlderNewer