Skip to content

Instantly share code, notes, and snippets.

@Kolyall
Last active October 23, 2020 21:07
Show Gist options
  • Save Kolyall/686fbc8eb563dad5eb762c049e6886d1 to your computer and use it in GitHub Desktop.
Save Kolyall/686fbc8eb563dad5eb762c049e6886d1 to your computer and use it in GitHub Desktop.
Docker
#Install Docker (Ubuntu)
https://www.digitalocean.com/community/tutorials/docker-ubuntu-18-04-1-ru
sudo apt update
sudo apt install apt-transport-https ca-certificates curl software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu bionic stable"
sudo apt update
apt-cache policy docker-ce
sudo apt install docker-ce
sudo systemctl status docker
#Добавление текущего юзера для избежания написания sudo docker
sudo usermod -aG docker ${USER}
su - ${USER}
id -nG
################Move docker to another dir
1. Move .docker directory from C:\Users\username to D:\
2. Run C:\Users\username>mklink /j .docker D:\.docker
-------------------------------------------------------------------------------
DOCKER
-------------------------------------------------------------------------------
docker pull coturiv/ci-android
docker run -it coturiv/ci-android /bin/bash
docker container ls
docker start cf0335a0d59a
docker restart cf0335a0d59a
docker exec -ti cf0335a0d59a /bin/bash
exit
docker stop cf0335a0d59a
docker container ls
docker ps
docker container ls --all
docker container rm {name1} {name2}
docker image ls
docker rmi {name1} {name2}
docker login
docker version
docker run -it ununtu bash
################LOGS OF container########################################
docker logs -t containerId
################GET IP of LOCAL MACHINE########################################
docker-machine ip
################STOP ALL containers##############################################
docker stop $(docker ps -a -q)
################REMOVE ALL containers##############################################
docker rm $(docker ps -a -q)
################REMOVE ALL IMAGES##############################################
docker rmi $(docker images -q)
_______________________________________________________________________________
-------------------------------------------------------------------------------
GIT
-------------------------------------------------------------------------------
git submodule update --init --recursive
git branch
git checkout origin/GRAM-1186
_______________________________________________________________________________
cd $ANDROID_HOME/tools/bin
yes | ./sdkmanager emulator
export PROJECTS="/projects"
export MAVEN_LOCAL="/root/.m2"
export PATH="${ANDROID_HOME}/emulator:${PATH}"
export PATH="${ANDROID_HOME}/tools:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools:${PATH}"
./sdkmanager "system-images;android-25;google_apis;x86"
yes | ./sdkmanager --licenses
./avdmanager list device
./avdmanager create avd -n test -k "system-images;android-25;google_apis;x86"
cd $ANDROID_HOME/tools
sudo apt-get install cpu-checker
kvm-ok
sudo apt-get install qemu-kvm libvirt-bin ubuntu-vm-builder bridge-utils
./emulator -avd test
./android list sdk -a
yes | ./sdkmanager sources;android-15
yes | ./sdkmanager sources;android-23
yes | ./sdkmanager platform-tools (this one is important else LC won't recoqnize the folder as sdk folder)
yes | ./sdkmanager platforms;android-15 (this is the minimum needed Android 4.0.3 for LC)
yes | ./sdkmanager platforms;android-23 (this is android 6.0)
yes | ./sdkmanager lldb;2.3
yes | ./sdkmanager ndk-bundle (not really needed)
yes | ./sdkmanager patcher;v4
yes | ./sdkmanager emulator
yes | ./sdkmanager docs (if you need docs)
yes | ./sdkmanager extras;google;google_play_services
yes | ./sdkmanager extras;google;market_licensing (not really needed)
yes | ./sdkmanager extras;google;usb_driver
yes | ./sdkmanager extras;intel;Hardware_Accelerated_Execution_Manager
yes | ./sdkmanager extras;play_billing (not really needed)
yes | ./sdkmanager build-tools;26.0.1
yes | ./sdkmanager build-tools;28.0.3
yes | ./sdkmanager add-ons;addon-google_apis-google-15
yes | ./sdkmanager add-ons;addon-google_apis-google-23
_______________________________________________________________________________
-------------------------------------------------------------------------------
LINUX:
-------------------------------------------------------------------------------
TAB->
pwd
ls -a
chmod a+x ./gradlew
mkdir -p ~/.gradle && echo "org.gradle.daemon=false" >> ~/.gradle/gradle.properties
rm -r mydir
rm -rf mydir
mv -v ~/Downloads/* ~/Videos/
_______________________________________________________________________________
-------------------------------------------------------------------------------
FOR NEW DOCKER
-------------------------------------------------------------------------------
docker pull coturiv/ci-android
docker run -it coturiv/ci-android /bin/bash
apt-get update
apt-get install git
cd $ANDROID_HOME/tools/bin
yes | ./sdkmanager --licenses
export MAVEN_LOCAL="/root/.m2"
cd
mkdir -p $MAVEN_LOCAL
cd $MAVEN_LOCAL
cd ..
git clone <path to lfs.git> .m2
mkdir workspace
cd workspace/
git clone <path to project.git>
cd gramophone-cafe-android/
git checkout master
git submodule update --init --recursive
chmod a+x ./gradlew
./gradlew assebmleDevelop
./gradlew installGitHooks
_______________________________________________________________________________
-------------------------------------------------------------------------------
Keystore:
-------------------------------------------------------------------------------
echo y | keytool -genkeypair -dname "cn=Denis Aper, ou=Individual, o=Sun, c=US" -alias MYALIAS -keypass mypassword1 -keystore android.keystore -storepass mypassword2 -keyalg RSA -keysize 2048 -validity 361350
_______________________________________________________________________________
-------------------------------------------------------------------------------
SINGLE COMMAND BASH
-------------------------------------------------------------------------------
echo "apt-get update; apt-get install git; cd $ANDROID_HOME/tools/bin; yes | ./sdkmanager --licenses; cd; export MAVEN_LOCAL="/root/.m2"; rm -rf .m2/; git clone <path to lfs.git> .m2; rm -rf workspace/; mkdir workspace; cd workspace/; git clone <path to project.git>; cd gramophone-cafe-android/; git checkout master; bash pipelines/cloneSubmodules.sh; bash modules/pipelines/releaseNotes.sh; chmod a+x ./gradlew; ./gradlew clean" >> initBash.sh
_______________________________________________________________________________
-------------------------------------------------------------------------------
TERMINAL COMMANDS
-------------------------------------------------------------------------------
git config --list
curl -X POST --data "payload={ \"icon_emoji\":\":andro:\", \"username\": \"Test Bot\", \"text\": \"Test message\"}" "$(git config --get hooks.slack.webhook-url)"
#Open http://play-with-docker.com and start a new session. You need to create an account first.
#Once your session is active click on “Add New Instance”:
vi Dockerfile
#copy/paste the contents of our Dockerfile, press “Esc” to exit “Insert Mode”, and save+exit by typing
:x
#Build the new image using the command docker build <path>
docker build ./
> Successfully built bab6c68f0175
#Add tag to image
docker tag bab6c68f0175 DOCKER_USER_NAME/myrepo:latest
docker login --username=DOCKER_USER_NAME -p=DOCKER_USER_PASSWORD
docker push DOCKER_USER_NAME/myrepo:latest
https://www.qatouch.com/blog/how-to-run-selenium-webdriver-with-docker/
################SETUP if no images################
docker network create grid
docker run -d -p 4444:4444 --net grid --name selenium-hub selenium/hub:3.14.0
docker run -d -p 32768:5900 --net grid -e HUB_HOST=selenium-hub -v /dev/shm:/dev/shm selenium/node-firefox-debug:3.14.0
docker ps
docker exec -it <container name> /bin/bash
docker-machine ip
docker stop $(docker ps -a -q)
docker rm $(docker ps -a -q)
docker rmi $(docker images -a)
docker network rm grid
sudo apt install nmap
nmap 172.17.0.1
Linux:
sudo apt-get install xtightvncviewer
vncviewer 172.17.0.1:32768
password is "secret"
sudo apt-get update
sudo apt-get -y install nautilus
Windows:
http://192.168.99.100:4444/grid/console
Run the VNC viewer 192.168.99.100:32768
password is secret
host <website>
ping <website>
nmap 192.168.1.33
sudo netstat -ntlp | grep LISTEN
sudo apt install net-tools
sudo apt install host
sudo apt install nmap
echo "external IP => $(curl --silent http://checkip.amazonaws.com)"
apt update
apt -y install mysql-server
service mysql start
mysql
create database имя_базы_данных;
use имя_базы_данных;
create table имя_таблицы (имя_первого_столбца тип, имя_второго_столбца тип, ..., имя_последнего_столбца тип );
create table myTable (id int, name text);
show databases - показать все имеющиеся БД,
show tables - показать список таблиц текущей БД (предварительно ее надо выбрать с помощью оператора use),
describe имя_таблицы - показать описание столбцов указанной таблицы.
drop table имя_таблицы;
drop database имя_базы данных;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment