This file contains 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
SELECT 'SELECT SETVAL(' ||quote_literal(S.relname)|| ', MAX(' ||quote_ident(C.attname)|| ') ) FROM ' ||quote_ident(T.relname)|| ';' | |
FROM pg_class AS S, pg_depend AS D, pg_class AS T, pg_attribute AS C | |
WHERE S.relkind = 'S' | |
AND S.oid = D.objid | |
AND D.refobjid = T.oid | |
AND D.refobjid = C.attrelid | |
AND D.refobjsubid = C.attnum | |
ORDER BY S.relname; |
This file contains 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 collections | |
import json | |
import redis | |
import threading | |
from tornado import gen | |
from tornado import ioloop | |
from tornado import web | |
from tornado.options import define | |
from tornado.options import options | |
import tornadoredis |
This file contains 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
class A(object): | |
def __init__(self): | |
super(A, self).__init__() | |
print 'class A' | |
class B(object): | |
def __init__(self): | |
super(B, self).__init__() | |
print 'class B' |
This file contains 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
=================== | |
Collector (v 3.9.0) | |
=================== | |
Status date: 2013-09-10 13:11:06 (10s ago) | |
Pid: 26192 | |
Platform: Linux-3.2.0-37-virtual-x86_64-with-Ubuntu-12.04-precise | |
Python Version: 2.7.3 | |
Logs: <stderr>, /var/log/datadog/collector.log, syslog:/dev/log |
This file contains 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
results = [] | |
with ParallelQuery() as p: | |
for feed_chunk in chunks(feed_ids, 500): | |
results.append(model_manager.filter(feed_id__in=feed_chunk).order_by('-activity_id')[:3600]) |
This file contains 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
feed_id | activity_id | actor | object | group | target | time | |
--------------+----------------------------+--------+-----------+--------+--------+-------------------------- | |
feed:flat:13 | 13714123640000258443592003 | 876882 | 258443592 | 1 | 831803 | 2013-06-16 21:52:44+0000 | |
feed:flat:13 | 13715879420000258938996003 | 255741 | 258938996 | 1 | 928068 | 2013-06-18 22:39:02+0000 | |
feed:flat:13 | 13763288090000271471001003 | 186818 | 271471001 | 2 | -1 | 2013-08-12 19:33:29+0000 | |
feed:flat:13 | 13769369290000272923490003 | 186818 | 272923490 | 1 | -1 | 2013-08-19 20:28:49+0000 | |
feed:flat:13 | 13771839640000273566662003 | 186818 | 273566662 | 3 | -1 | 2013-08-22 17:06:04+0000 | |
feed:flat:13 | 13771843770000273567924003 | 186818 | 273567924 | 2 | -1 | 2013-08-22 17:12:57+0000 | |
feed:flat:13 | 13776966170000274963671003 | 186818 | 274963671 | 2 | -1 | 2013-08-28 15:30:17+0000 | |
feed:flat:13 | 13776970820000274965647003 | 186818 | 27496564 |
This file contains 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
<script> | |
alert() | |
</script> |
This file contains 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
$digest = hash_hmac('sha1', $feed_id, sha1($key, true), true);; | |
return trim(strtr(base64_encode($value), '+/', '-_'), '='); |
This file contains 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 | |
function get_users($ids){ | |
// queries the db and returns an assoc array eg. array(1=>user1,...) | |
return array( | |
'1'=> 'tommaso', | |
'2'=> 'mike', | |
'3'=> 'thierry', | |
); |
This file contains 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
function autoload($className) | |
{ | |
$className = ltrim($className, '\\'); | |
$fileName = ''; | |
$namespace = ''; | |
if ($lastNsPos = strrpos($className, '\\')) { | |
$namespace = substr($className, 0, $lastNsPos); | |
$className = substr($className, $lastNsPos + 1); | |
$fileName = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; | |
} |