Skip to content

Instantly share code, notes, and snippets.

@jamil666
jamil666 / CBAR currency
Created August 6, 2019 09:06
Parsing cbar.az currency and make dictionary with current values
import requests
from bs4 import BeautifulSoup
URL = 'https://www.cbar.az/currency/rates'
response = requests.get(URL)
soup = BeautifulSoup(response.content, 'html.parser')
codes = []
values = []
import requests
from hpe3parclient import client, exceptions
username = 'username'
password = 'password'
# Storage IP
ip_address = 'IP'
Storage = 'Storage Name'
@jamil666
jamil666 / User Lockout Source
Created December 3, 2019 09:28
Powershell script for finding user lockout source
## Define the username that’s locked out
$Username = Read-Host "Please enter username: "
## Find the domain controller PDCe role
$Pdce = (Get-AdDomain).PDCEmulator
# Check if user locked out
$LocketOutStatus = Get-ADUser -Properties LockedOut -Identity $Username | select LockedOut
if ($LocketOutStatus.LockedOut -eq 'True'){
from pyVim.connect import SmartConnect, SmartConnectNoSSL, Disconnect
from pyVmomi import vim
import re, ssl
vc = 'Vcenter name'
username = 'username'
password = 'password'
pg = input('New network name: ') # Port Group name in Vcenter
vlan_id = input('New vlan ID: ') # Vlan ID
esx_host = ['esxi1', 'esxi2'] # List of ESXi hosts
@jamil666
jamil666 / Py2EXE
Created February 26, 2020 13:36
Convert Python to EXE file
from PyQt5 import QtCore, QtGui, QtWidgets
import os
class Ui_MainForm(object):
# Select Python file
def open_python_file(self):
directory = QtWidgets.QFileDialog.getOpenFileName(directory="C:\\", filter="*.py")
self.InputFile.setText(directory[0])
@jamil666
jamil666 / UserLastLogonInfo_in_Database
Created March 16, 2020 10:01
Needed modules: PSSQlite, Quest Active Directory
Import-Module PSSQLite
Add-PSSnapin Quest.ActiveRoles.ADManagement
# Database path
$Database = "C:\report\UsersLastLogon.SQLite"
$Query = "CREATE TABLE IF NOT EXISTS UsersLastLogon (
Username TEXT,
Computername TEXT,
LastLogon TEXT)"