Skip to content

Instantly share code, notes, and snippets.

View 0xIslamTaha's full-sized avatar
🤩
code with love ... test with imagination

Islam Taha 0xIslamTaha

🤩
code with love ... test with imagination
View GitHub Profile
import math
import time
import requests
import gevent
import netaddr
from jumpscale import j
from zerorobot.service_collection import ServiceNotFoundError
from zerorobot.template.base import TemplateBase
@0xIslamTaha
0xIslamTaha / s3.py
Last active September 27, 2018 12:45
from jumpscale import j
import click, uuid, csv
from multiprocessing import Process, Manager
logger = j.logger.get('s3_deployment')
minio_results_file = 'minio_results_file.csv'
#python3 s3.py --robot local --s3_instances 1 --zt_token ****** --zt_nw_id 35c192ce9b3fecb5 --farmer_name tlre --storage_type hdd --storage_size 5 --minio_login minio_login --minio_password **
@click.command()
# python3 check_nodes_version.py -f 'kristof-farm' -c 'cb52b076df76c4da6be41999f65f87a047437f30'
from jumpscale import j
logger = j.logger.get('check_node_commit')
import click
@click.command()
@click.option("-f", "--farm_name", help="farm name to update its zrobot", required=True)
@click.option("-c", "--commit_id", help="match with this commit id", default='')
import collections
from subprocess import Popen, PIPE
def execute_cmd(cmd):
sub = Popen(cmd, stdout=PIPE, stderr=PIPE, shell=True)
out, err = sub.communicate()
return out, err
out, err = execute_cmd('ip n')
ip_n_data = str(out)
from jumpscale import j
import click
@click.command()
@click.option("-f", "--farm_name", help="farm name to update its zrobot", required=True)
def main(farm_name):
capacity = j.clients.threefold_directory.get(interactive=False)
resp = capacity.api.ListCapacity(query_params={'farmer': farm_name})[1]
nodes = resp.json() #nodes
for node in nodes:

0-db level:

data 0-db temporary unavailable

    def test001_upload_stop_parity_zdb_download(self):
        """
        - upload 2M, should succeed.
        - Download file, should succeed
        - Deleted the downloaded file
        - assert md5 checksum is matching
        - Stop n zdb, n <= parity
```python
s3 = demo.s3['s3_demo_5']
tlog = s3.service.data['data']['tlog']
robot = j.clients.zrobot.robots[tlog['node']]
robot._try_god_token()
ns = robot.services.get(name=tlog['name'])
print(ns.name)
zdb = robot.services.get(name=ns.data['data']['zerodb'])
from jumpscale import j
from termcolor import colored
from random import randint
import click, uuid
# Templates
zerotier_template = "github.com/threefoldtech/0-templates/zerotier_client/0.0.1"
dm_vm_template = "github.com/threefoldtech/0-templates/dm_vm/0.0.1"
#python3 dm.py -r local -t ******* -i 35c192ce9ba98299 -n ac1f6b456b98 -im ubuntu -dt hdd -ds 5 -m 2048 -c 1 -s "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT"
from jumpscale import j
key = 'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCjPfKUsaFuaGJsnHvF3k0PbqQTr3GL2pNuddn/xQjsroF35ELJVEovAsd9IlsFWOmDWlL6B+JYFgj8g5IykklHCDfmTu6LcGXjdfAYVp+eXARmgoCJKxVyenSVHu6No9O1e+QKFvMJTiJXdl08fZD1Fd2kRetDRKAijCZ76pmB4/KwVFiJKCVVdsDW/0R+td0gNVJyCQyRTcWEPmBfGMW/JrvRCSHfxlLdqsD3txLOm9pHlQ/LmEwOP3bqEEpQU1jP32JbdAdreuD6BYB+YRp02yyU33gd1QbqIEgftcN+6TuZJOU3j2VRSiUQX8h5SjtWV1UXE15ELlIlhcFJYH6L root@islamtaha-TT'
node = j.clients.zos.get('e0d55e6af8cd', data={'host':'10.102.132.23'})
# Like vm template
data = {'configs': [{'content': key,
'name': 'ssh',
'path': '/root/.ssh/authorized_keys'}],
'cpu': 2,
@0xIslamTaha
0xIslamTaha / install_jsx.sh
Last active February 4, 2019 12:21
install jsx
apt-get update
apt-get install -y curl python3-dev locales
export INSYSTEM=0
export USEGIT=1
curl https://raw.githubusercontent.com/threefoldtech/jumpscaleX/master/install/install.py?$RANDOM > /tmp/install.py;python3 /tmp/install.py