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 zmq | |
import urlparse | |
import urllib | |
import json | |
DEFAULT_TIMEOUT=5 | |
def parse(link): | |
url_data = urlparse.urlparse(link) | |
query = urlparse.parse_qs(url_data.query) |
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 zmq | |
import sys | |
context = zmq.Context() | |
socket = context.socket(zmq.PUSH) | |
socket.connect("tcp://172.21.0.49:5000") | |
socket.send_json({'video': sys.argv[1]}) | |
sys.exit(0) |
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
#!/usr/bin/env python | |
# Jorge Niedbalski <jnr@pyrosome.org> | |
class Query: | |
def __init__(self): | |
(self.c, self.d) = ([],[]) | |
def a(self, d): | |
self.d.append(d) |
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
convertion = [ | |
(1024 ** 5, 'P'), | |
(1024 ** 4, 'T'), | |
(1024 ** 3, 'G'), | |
(1024 ** 2, 'M'), | |
(1024 ** 1, 'K'), | |
(1024 ** 0, 'B'), | |
] | |
def size_suffix(bytes): |
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
from Crypto.Hash import HMAC | |
from Crypto.Hash import SHA | |
import hashlib | |
import datetime | |
class Auth: | |
@classmethod | |
def sign(cls, method, c_type, body, uri, key=None): |
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
#!/usr/bin/env python | |
# | |
# Provides a rather basic version of rmadison (or dak ls if you prefer) | |
# for the Ubuntu cloud-archive. | |
# | |
# This script works in the following manner: | |
# 1) It will show the rmadison output for the selected package to show | |
# the values of packages within the main ubuntu archives | |
# 2) It will show similar output for the selected package in the ubuntu | |
# cloud archives. |
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
# valid for juju 2.0 | |
# see https://bugs.launchpad.net/ubuntu/+source/juju-mongodb3.2/+bug/1583740 | |
$ juju ssh -m controller 0 | |
# when running a Xenial controller | |
/usr/lib/juju/mongo3.2/bin/mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin | |
# when running a Bionic controller | |
mongo --sslAllowInvalidCertificates --ssl -u admin -p $(grep oldpassword /var/lib/juju/agents/machine-0/agent.conf | awk -e '{print $2}') localhost:37017/admin |
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
// FROM: http://www.mongodb.org/display/DOCS/Updating#Updating-update%28%29 | |
// | |
// db.collection.update( criteria, objNew, upsert, multi ) | |
// criteria - query which selects the record to update; | |
// objNew - updated object or $ operators (e.g., $inc) which manipulate the object | |
// upsert - if this should be an "upsert"; that is, if the record does not exist, insert it | |
// multi - if all documents matching criteria should be updated | |
// | |
// SQL VERSION: | |
// UPDATE myTable SET dateField = '2011-01-01' WHERE condField = 'condValue' |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/juju/utils" | |
) | |
const MIN_LEN = 30 |
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
package main | |
import ( | |
"fmt" | |
"os" | |
"github.com/juju/utils" | |
) | |
const MIN_LEN = 30 |
OlderNewer