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

#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
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__))
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:
sudo apt-get update && apt-get upgrade
cd ~/builds/
git clone https://github.com/travis-ci/travis-build.git
cd travis-build/
gem sources -a http://rubygems.org
rvm install 2.3.0
rvm --default use 2.3.0
gem install travis
gem install bundler --pre
sed -i 's/https:/http:/g' Gemfile
echo "prepare docker"
apt-get update && apt-get upgrade
apt-get install -y zsh git ipython3 python3-dev python3-pip git xvfb tmux wget curl vim unzip libnspr4 libnss3 lsb-release xdg-utils libxss1 libdbus-glib-1-2 fonts-liberation libappindicator3-1 libasound2 libatk-bridge2.0-0
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
chsh -s `which zsh`
echo "Install latest stable chrome"
CHROME_SETUP=google-chrome.deb && wget -O $CHROME_SETUP "https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb" && dpkg -i $CHROME_SETUP && apt-get install -y -f && rm $CHROME_SETUP
@0xIslamTaha
0xIslamTaha / saberDav_php_nginx.md
Last active July 25, 2019 08:06
saberDav, php, nginx installation steps

1- Installation steps:

apt-get install -y nginx php php-fpm php-mysql htop vim php7.2-xml php-mbstring unzip php-curl
mkdir /var/www/html/saberdav 
cd /var/www/html/saberdav
mkdir data public
php -r "readfile('http://getcomposer.org/installer');" > composer-setup.php && php composer-setup.php --install-dir=/usr/bin --filename=composer && php -r "unlink('composer-setup.php');" && composer require sabre/dav ~3.2.0 

2- Create server.php:

def tomato_cheese(c, t):
if t % 2 != 0 or c <= 0 or t <= 0 or t/2 < c:
return [-1, -1]
if t/2 == c:
return [int(t/2), 0]
mini, big = 0, 0
if t/2 > c:
t = t - 4
from Jumpscale import j
server = j.servers.openresty.get("test")
server.install(reset=True)
server.configure()
website = server.websites.get("test")
website.ssl = False
locations = website.locations.get("main")
website_location = locations.locations_static.new()
website_location.name = "home"