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
from selenium import webdriver
from selenium.webdriver.support.ui import Select
driver = webdriver.Chrome()
driver.maximize_window()
driver.implicitly_wait(30)
driver.get('https://azure.microsoft.com/en-us/pricing/details/virtual-machines/linux/')
select_option = Select(driver.find_element_by_id('region-selector'))
options = select_option.options
for option in options:
from importlib import util
import os
import subprocess
import sys
BRANCH = "development"
# get current install.py directory
rootdir = os.path.dirname(os.path.abspath(__file__))

#pre-requests: There should be a running etcd server with api v3 and an authontication. The following script can do that for you

wget https://github.com/etcd-io/etcd/releases/download/v3.3.11/etcd-v3.3.11-linux-amd64.tar.gz
tar -xzfv etcd-v3.3.11-linux-amd64.tar.gz
cp etcd-v3.3.11-linux-amd64/etcd /usr/bin
cp etcd-v3.3.11-linux-amd64/etcdctl /usr/bin
export ETCDCTL_API="3"
etcd&
etcdctl user add root:root
@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
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,
```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'])
```python
JSX> tft_client = j.clients.tfchain.new(name='tft_client', network_type='TEST')
Mon 24 10:45:50 BCDB.py - 465 - bcdb:bcdb : load model:jumpscale.tfchain.client
JSX> wallet = tft_client.wallets.new('wallet001', seed='slam table target hand drift aim brief fit dizzy flash engine attend oil steel manage oblige mercy duck razor steak crash essay coin stone')
Mon 24 10:45:56 BCDB.py - 465 - bcdb:bcdb : load model:jumpscale.tfchain.wallet
JSX> wallet.balance
wallet balance on height 304409 at 2019/06/24 10:45:24
3457.95 TFT available and 0 TFT locked
JSX> wallet.capacity.reserve_zos_vm(email="tft.testing.

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
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:
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)