This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup as bs | |
locations = ['Devonport', 'Takapuna'] | |
data = {} | |
for location in locations: | |
url = "https://www.tenancy.govt.nz/rent-bond-and-bills/market-rent/?location={}".format(location) | |
html = requests.get(url).text | |
soup = bs(html, "html.parser") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Delta: | |
def __init__(self,old,new): | |
newset = set(new.rules) | |
oldset = set(old.rules) | |
self.deleted = list(oldset - newset) | |
self.added = list(newset - oldset) | |
self.retained = list(oldset & newset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Get-ADDomainController -Filter * ` | |
| Select Name, IsGlobalCatalog, Site, IPV4Address, ` | |
@{N='SchemaMaster';E={'SchemaMaster' -in $_.OperationMasterRoles}}, ` | |
@{N='DomainNamingMaster';E={'DomainNamingMaster' -in $_.OperationMasterRoles}}, ` | |
@{N='PDCEmulator';E={'PDCEmulator' -in $_.OperationMasterRoles}}, ` | |
@{N='RIDMaster';E={'RIDMaster' -in $_.OperationMasterRoles}}, ` | |
@{N='InfrastructureMaster';E={'InfrastructureMaster' -in $_.OperationMasterRoles}} ` | |
| FT -AutoSize |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Save current installed packages | |
pip freeze > requirements.txt | |
# Install packages from requirents.txt | |
pip install -r requirements.txt | |
# Remove packages not in requirements.txt | |
pip freeze | grep -v -f requirements.txt - | xargs pip uninstall -y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$searcher = [adsisearcher]"(&(objectCategory=computer)(cn=$env:COMPUTERNAME))" | |
$searcher.FindOne().Properties.memberof -replace '^CN=([^,]+).+$','$1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Get-AvailableUpdates { | |
[CmdletBinding()] | |
Param() | |
$wu_session = New-Object -ComObject Microsoft.Update.Session | |
$wu_searcher = $wu_session.CreateUpdateSearcher() | |
$updates = $wu_searcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") | |
return $updates.Updates ` | |
| Select Title, RebootRequired, IsInstalled, IsDownloaded, IsHidden, IsPresent, ` | |
@{Name='KbArticleIds';Expression={$_.KbArticleIds}}, ` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash -eux | |
hostname=$1 | |
scutil --set HostName ${hostname} | |
scutil --set ComputerName ${hostname} | |
scutil --set LocalHostName ${hostname} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from plexapi.server import PlexServer | |
from plexapi.myplex import MyPlexAccount | |
from pytvdbapi import api as tvdbapi | |
API_KEY = 'TVDB API Key' | |
USERNAME = 'Plex Username' | |
PASSWORD = 'Plex Password' | |
SERVER_NAME = 'Plex Server Name' | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import json | |
import requests | |
def get_clients(): | |
PORTAL_URL = 'https://0.0.0.0:8443/' | |
PORTAL_LOGIN_PARAMS = { | |
'username': '', | |
'password': '', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
url = 'https://api.imgflip.com/caption_image' | |
payload = { | |
'username': "imgflip_hubot", | |
'password': "imgflip_hubot", | |
'template_id': "101470", | |
'text1': 'Robots', |