Skip to content

Instantly share code, notes, and snippets.

View diegows's full-sized avatar
🏡
Working from home!

Diego Woitasen diegows

🏡
Working from home!
View GitHub Profile
@diegows
diegows / XDocument
Last active December 17, 2015 18:39
A proposal for MongoEngine-extra (or may be MongoEngine itself) to support global DB switch per thread.
class CSDocument(object):
_collections = defaultdict(lambda: None)
active_db = None
@classmethod
def switch_active_db(cls, dbname):
cls.active_db = dbname
@classmethod
def _get_db(cls):
@diegows
diegows / ssh-agent
Last active December 21, 2015 04:49 — forked from rezlam/ssh-agent
pgrep is better for this job. ps ax | grep ssh-agent founds the grep itself and fails.
SSH_ENV="$HOME/.ssh/environment"
# start the ssh-agent
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
ssh-agent | sed 's/^echo/#echo/' > "$SSH_ENV"
echo succeeded
chmod 600 "$SSH_ENV"
. "$SSH_ENV" > /dev/null
@diegows
diegows / base.py
Last active December 23, 2015 06:59
CSDocument class, a class to be used with Mongoengine's Document class to create documents. It allows DB switch on the fly.
import threading
import warnings
from collections import defaultdict
from mongoengine import *
from mongoengine.connection import get_db
def dbconnect(company):
global company_name
@diegows
diegows / gist:8533410
Last active January 3, 2016 23:09
3 nodes Accumulo cluster (m1.large) kvlayer node m1.xlarge
100 MB written in 20.2 seconds --> 5.0 MB/sec across 1 workers for storage_type=accumulo
100 MB written in 21.0 seconds --> 4.8 MB/sec across 1 workers for storage_type=accumulo
500 MB written in 23.2 seconds --> 21.5 MB/sec across 5 workers for storage_type=accumulo
500 MB written in 15.3 seconds --> 32.6 MB/sec across 5 workers for storage_type=accumulo
1000 MB written in 54.0 seconds --> 18.5 MB/sec across 10 workers for storage_type=accumulo
1000 MB written in 38.0 seconds --> 26.3 MB/sec across 10 workers for storage_type=accumulo
2500 MB written in 159.9 seconds --> 15.6 MB/sec across 25 workers for storage_type=accumulo
2500 MB written in 162.9 seconds --> 15.3 MB/sec across 25 workers for storage_type=accumulo
5000 MB written in 376.1 seconds --> 13.3 MB/sec across 50 workers for storage_type=accumulo
5000 MB written in 402.3 seconds --> 12.4 MB/sec across 50 workers for storage_type=accumulo
[20/Jan/2014:21:12:50 -0300] - _csngen_adjust_local_time: gen state
before 52ddb8ec0001:1390262479:0:29
[20/Jan/2014:21:12:50 -0300] - _csngen_adjust_local_time: gen state
after 52ddbb9f0000:1390263170:0:29
[20/Jan/2014:21:12:50 -0300] NSMMReplicationPlugin -
ruv_add_csn_inprogress: successfully inserted csn 52ddbb9f000000630000
into pending list
[20/Jan/2014:21:12:50 -0300] NSMMReplicationPlugin - Purged state
information from entry
uid=zzj,ou=People,ou=branch,ou=branches,dc=site,dc=ar up to CSN
[root@solariat01 EGG-INFO]# easy_install http://egguser:[email protected]:8080/eggs/solariat_pool-0.3.3-py2.6.egg
Downloading http://egguser:[email protected]:8080/eggs/solariat_pool-0.3.3-py2.6.egg
Processing solariat_pool-0.3.3-py2.6.egg
removing '/usr/lib/python2.7/site-packages/solariat_pool-0.3.3-py2.6.egg' (and everything under it)
creating /usr/lib/python2.7/site-packages/solariat_pool-0.3.3-py2.6.egg
Extracting solariat_pool-0.3.3-py2.6.egg to /usr/lib/python2.7/site-packages
solariat-pool 0.3.3 is already the active version in easy-install.pth
Installed /usr/lib/python2.7/site-packages/solariat_pool-0.3.3-py2.6.egg
Processing dependencies for solariat-pool==0.3.3
dirs = [
"solariat",
"solariat_pool",
"solariat_nlp"
]
for dir in dirs do
project_path = "/opt/tango/#{dir}"
if ::File.exists?(project_path) then
{% for region in [ "eu-west-1", "sa-east-1", "ap-northeast-1", "us-west-2", "ap-southeast-1" ] %}
locust-secgroup-{{ region }}:
boto_secgroup.present:
- name: locust
- description: locust
- rules:
- ip_protocol: tcp
to_port:
- 80
2014-12-15 11:00:05,235 [salt.loaded.int.module.saltutil][INFO ] Copying '/var/cache/salt/minion/files/base/_modules/openstack.py' to '/var/cache/salt/minion/extmods/modules/openstack.py'
2014-12-15 11:00:05,271 [salt.minion ][INFO ] Returning information for job: 20141215110003484516
2014-12-15 11:00:05,572 [salt.loader ][WARNING ] Failed to import module openstack, this is due most likely to a syntax error. Traceback raised:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/salt/loader.py", line 903, in load_modules
), fn_, path, desc
File "/var/cache/salt/minion/extmods/modules/openstack.py", line 3, in <module>
mine_get = __salt__['mine.get']
NameError: name '__salt__' is not defined
heat_template_version: 2013-05-23
description: Test Template
parameters:
ImageID:
type: string
description: Image use to boot a server
NetID:
type: string