Skip to content

Instantly share code, notes, and snippets.

View Ramhm's full-sized avatar
👾

Ramin Hakimi Ramhm

👾
View GitHub Profile
@Ramhm
Ramhm / save_screenshot.py
Created February 12, 2021 14:59 — forked from fabtho/save_screenshot.py
make full screenshot with selenium in python
#!/usr/bin/python
from selenium import webdriver
from PIL import Image
from cStringIO import StringIO
verbose = 1
browser = webdriver.Firefox()
browser.get('http://stackoverflow.com/questions/37906704/taking-a-whole-page-screenshot-with-selenium-marionette-in-python')
@Ramhm
Ramhm / bot.py
Created February 12, 2021 14:58 — forked from stevenctl/bot.py
Python Selenium Reusable Browser Session
# Sometimes I have some tedious thing to do like data entry
# Sometimes I script that tedious thing using selenium
# Sometimes I have to login to something to enter that data
# This allows you to rerun your script using the same session
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import os
SELENIUM_SESSION_FILE = './selenium_session'
@Ramhm
Ramhm / youtube_comment_bot.py
Created February 12, 2021 14:57 — forked from streetgt/youtube_comment_bot.py
Youtube Comment Bot - python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Python bot for comment a list of urls in YouTube
import time
import numpy as np
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
@Ramhm
Ramhm / instabot1.py
Created February 12, 2021 14:31 — forked from fnneves/instabot1.py
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from time import sleep, strftime
from random import randint
import pandas as pd
chromedriver_path = 'C:/Users/User/Downloads/chromedriver_win32/chromedriver.exe' # Change this to your own chromedriver path!
webdriver = webdriver.Chrome(executable_path=chromedriver_path)
sleep(2)
webdriver.get('https://www.instagram.com/accounts/login/?source=auth_switcher')
@Ramhm
Ramhm / db_backup.sh
Created September 16, 2019 06:46 — forked from NARKOZ/db_backup.sh
MySQL backup shell script
#!/bin/bash
# Shell script to backup MySQL database
# Set these variables
MyUSER="" # DB_USERNAME
MyPASS="" # DB_PASSWORD
MyHOST="" # DB_HOSTNAME
# Backup Dest directory
DEST="" # /home/username/backups/DB
@Ramhm
Ramhm / comconfig.yml
Last active September 2, 2018 11:25
Ansible (Sample Config)
---
- hosts: all
gather_facts: no
tasks:
- name: Change HostName
shell: echo "HOSTNAME" > /etc/hostname
- name: Remove Line2 /etc/hosts
shell: /usr/bin/ex -sc '2d|x' /etc/hosts
@Ramhm
Ramhm / copy_file.yml
Created September 2, 2018 11:22
Ansible (Copy Files)
---
- hosts: all
gather_facts: no
tasks:
- name: Copy txt File
copy: src=/etc/ansible/asset_ansible/testfile.txt dest=/root/
@Ramhm
Ramhm / upgrade_ubuntu.yml
Created September 2, 2018 11:21
Ansible (upgrade Ubuntu)
---
- hosts: all
gather_facts: no
tasks:
- name: Upgrade All Packages
apt:
update_cache: yes
upgrade: yes
@Ramhm
Ramhm / add-sshkey.yml
Created September 2, 2018 11:20
Ansible (Add SSh key to linux)
---
- hosts: all
gather_facts: no
tasks:
- name: Add ssh key
blockinfile:
path: /root/.ssh/authorized_keys
block: |
{{ item.sshkey }} {{ item.name }}
marker: "# {mark} ANSIBLE RULE"
@Ramhm
Ramhm / ping.yml
Created September 2, 2018 11:19
Ansible (ping Host)
---
- hosts: all
gather_facts: no
tasks:
- name: ping all hosts
ping: