Skip to content

Instantly share code, notes, and snippets.

View mamedshahmaliyev's full-sized avatar

Mamed Shahmaliyev mamedshahmaliyev

View GitHub Profile
@mamedshahmaliyev
mamedshahmaliyev / android_debug_wifi.bat
Last active October 16, 2020 06:19
android usb debug without cable over wireless
adb devices
adb -s 15a5e8fc(deviceId) tcpip 5555
adb connect 192.168.0.100:5555
adb devices
adb -s LGLS992a4b7c95d tcpip 5555
adb connect 192.168.0.157:5555
@mamedshahmaliyev
mamedshahmaliyev / windows_hiberante.bat
Created May 28, 2020 06:18
windows hibernation commands
# enable hibernate
Powercfg /h on
# disable hibernate
Powercfg /h off
# specifiy hibernation file size as percentage of total RAM (between 50 and 100)
Powercfg /h /size nn
# view hibernation file size
@mamedshahmaliyev
mamedshahmaliyev / flutter_overlay.dart
Created May 7, 2020 13:32
flutter overlay with opacity
Stack(
children: <Widget>[
Column(
children: <Widget>[
Container(),
Container(),
],
),
_overlay(True)
],
@mamedshahmaliyev
mamedshahmaliyev / extend_lvm_linux.sh
Last active June 8, 2020 07:03
extend linux disk volume size in virtual machina
reboot # if no free sector error occurs
fdisk -l
fdisk /dev/sda
# type n -> p -> 3
# type t -> 3 -> 8e
# type w
reboot
pvcreate /dev/sda3
vgdisplay
vg_name='centos'
@mamedshahmaliyev
mamedshahmaliyev / centos7_tips.sh
Created November 19, 2019 07:14
CentOS 7 tips
# install vmware tools
yum install -y open-vm-tools
@mamedshahmaliyev
mamedshahmaliyev / python_tips.py
Last active December 8, 2020 10:13
diffrent ad-hoc tasks in python
# pickle save and load
import pickle
pickle.dump(obj, open(file, 'wb'))
obj = pickle.load(open(file, 'rb'))
# datetime tasks
import datetime
datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
# get execution time
@mamedshahmaliyev
mamedshahmaliyev / chroot.sh
Last active October 29, 2019 19:49
How to create chroot user
useradd sftp_user
passwd sftp_user
#################################################################################################################
# VERY IMPORTANT: all the elements in /path/to/chroot_folder must be owned by root with at most 755 permissions #
#################################################################################################################
echo '''
Match User sftp_user
X11Forwarding no
AllowTcpForwarding no
@mamedshahmaliyev
mamedshahmaliyev / ssh_no_prompt_multi_hosts.sh
Last active October 15, 2019 17:51
create ssh key pair silently using ssh-keygen without prompt and ssh-copy-id to multiple hosts
# generate ssy key pair silently
yes y | ssh-keygen -t rsa -N "" -f ~/.ssh/id_rsa > /dev/null
# register public key in multiple hosts
for ip in "192.168.0.1" "192.168.0.2"; do sshpass -p 'toor' ssh-copy-id -oStrictHostKeyChecking=no "root@$ip" > /dev/null; done
@mamedshahmaliyev
mamedshahmaliyev / raspbian_selenium.sh
Last active March 18, 2024 08:17
Install selenium with chrome driver in raspbian for raspberry pi 3
apt-get install chromium-chromedriver --yes
apt-get install xvfb --yes
pip install PyVirtualDisplay xvfbwrapper selenium
echo '''
from pyvirtualdisplay import Display
from selenium import webdriver
display = Display(visible=0, size=(1024, 768))
display.start()
opts = webdriver.ChromeOptions()

fix ansible bug: Bitbucket_access_key list object is not an iterator (python 2.7 compat), ansible/ansible#58456

find / -type f -name "bitbucket_access_key.py" -exec sed -i "s/next(filter(lambda/next(iter(filter(lambda/g" {} +
find / -type f -name "bitbucket_access_key.py" -exec sed -i "s/\]), None/\])), None/g" {} +