Skip to content

Instantly share code, notes, and snippets.

class Account(models.Model):
pass
class CustomUser(AbstractBaseUser, PermissionsMixin):
accounts = models.ManyToManyField(Account,
through='CustomUserAccount')
changed_by = models.ForeignKey(CustomUser, null=True, blank=True)
@property
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
$script = <<SCRIPT
echo I am provisioning...
echo Installing EPEL packages...
su -c 'rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm'
select time, sum(sum) from metrics_rollup60
where name = 'bytes_sent.tcp_miss1.0044b.ha.300' and
to_unixtime(time) > to_unixtime(TIMESTAMP '2013-01-01 00:00:00.000') and
to_unixtime(time) < to_unixtime(TIMESTAMP '2013-01-31 00:00:00.000')
GROUP BY time;
time | _col1
-------------------------+------------
2013-01-01 00:01:00.000 | 432498985
2013-01-01 00:02:00.000 | 155681891
@csarcom
csarcom / gist:20ded1d158b7dcb4f2cb
Last active August 29, 2015 14:08
Presto empty rows
select from_unixtime(86400 + floor(to_unixtime(time) / 86400) * 86400), sum(sum) from metrics_rollup60 where name= 'bytes_sent.0044b.ha' and to_unixtime(time) > to_unixtime(TIMESTAMP '2014-09-29 00:00:00.000') and to_unixtime(time) < to_unixtime(TIMESTAMP '2014-11-30 00:00:00.000') GROUP BY floor(to_unixtime(time) / 86400);
Result:
_col0 | _col1
-------------------------+---------
2014-10-02 00:00:00.000 | 1083855
2014-10-03 00:00:00.000 | 1080823
2014-10-04 00:00:00.000 | 1076970
2014-10-05 00:00:00.000 | 1080710
2014-10-29T13:03:01.174+0000 INFO main Bootstrap PROPERTY DEFAULT RUNTIME DESCRIPTION
2014-10-29T13:03:01.175+0000 INFO main Bootstrap cassandra.allow-drop-table false false Allow hive connector to drop table
2014-10-29T13:03:01.175+0000 INFO main Bootstrap cassandra.client.connect-timeout 5000.00ms 5000.00ms
2014-10-29T13:03:01.175+0000 INFO main Bootstrap cassandra.client.read-timeout 12000.00ms 12000.00ms
2014-10-29T13:03:01.175+0000 INFO main Bootstrap cassandra.client.so-linger null null
2014-10-29T13:03:01.176+0000 INFO main Bootstrap cassandra.consistency-level
[ERROR] Found a problem with the direct dependency com.google.guava:guava of the current project
Expected version is 16.0.1
Resolved version is 16.0.1
Version 18.0 was expected by artifact: io.airlift:testing
[DEBUG] Ended DependencyVersionsCheckMojo mojo run!
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] presto-root ........................................ SUCCESS [05:04 min]
[INFO] presto-spi ......................................... FAILURE [ 47.515 s]
presto:store> select * from metrics_rollup60 where name = 'upstream_cache_status.miss.2747t.hd' limit 10;
name | time | count | sum
-------------------------------------+-------------------------+--------+--------
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:45:00.000 | 9893 | 9893
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:46:00.000 | 166883 | 166883
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:47:00.000 | 223586 | 223586
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:48:00.000 | 232457 | 232457
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:49:00.000 | 234066 | 234066
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:50:00.000 | 240202 | 240202
upstream_cache_status.miss.2747t.hd | 2014-10-29 18:51:00.000 | 231517 | 231517
presto:store> select * from metrics_rollup60 where name = 'bytes_sent.miss.2747t.hd' limit 10;
name | time | count | sum
--------------------------+-------------------------+--------+------------
bytes_sent.miss.2747t.hd | 2014-10-29 18:45:00.000 | 9893 | 112072036
bytes_sent.miss.2747t.hd | 2014-10-29 18:46:00.000 | 166883 | 1637354586
bytes_sent.miss.2747t.hd | 2014-10-29 18:47:00.000 | 223586 | 2271573231
bytes_sent.miss.2747t.hd | 2014-10-29 18:48:00.000 | 232457 | 2432849911
bytes_sent.miss.2747t.hd | 2014-10-29 18:49:00.000 | 234066 | 2453397952
bytes_sent.miss.2747t.hd | 2014-10-29 18:50:00.000 | 240202 | 2371110880
bytes_sent.miss.2747t.hd | 2014-10-29 18:51:00.000 | 231517 | 2360339360
lista = [1,2,3,3,4]
defmodule Misc do
def dup([]) do
{:done, nil}
end
def dup(list) do
_dup(list, [])
end
def _dup([], result) do
@csarcom
csarcom / komby.py
Created September 11, 2015 17:54
komby enforce bind
def _create_exchange(self):
return kombu.Exchange(self._amqp_exchange_name, type='direct',
durable=True, auto_delete=False)
def _create_queue(self, exchange):
return kombu.Queue(self._queue_name, auto_delete=False)
def _enforce_bind(self):
with kombu.Connection(host) as connection: