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 | |
for i in "$@" | |
do | |
case $i in | |
-d=*|--domain=*) | |
DOMAIN="${i#*=}" | |
shift # past argument=value | |
;; | |
-w=*|--workgroup=*) | |
WORKGROUP="${i#*=}" |
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
# pip install progressbar | |
# see stuff at line 29 if you wanna change things | |
from collections import namedtuple, defaultdict | |
from itertools import product | |
class PowerGenerator(namedtuple("PowerGenerator", "name, min_power, max_power, startup_fee, shutdown_fee, price_func, step")): | |
def __repr__(self): | |
return f"{self.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
sensor: | |
- platform: mqtt | |
state_topic: "garage/temperature" | |
name: Garage Raw Temp | |
availability_topic: "garage/sensor0" | |
payload_available: "online" | |
payload_not_available: "offline" | |
- platform: template | |
sensors: | |
garage_temperature: |
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 aw_imei_to_snow.app import get_devices as get_devices_from_airwatch | |
from aw_imei_to_snow.update_snow import check_serial_number, update_snow_manufacturer_part_id | |
import logging | |
logging.basicConfig(filename='u_manufacturer_part_id.log', level=logging.DEBUG, | |
format='%(asctime)s %(message)s', filemode='w') | |
#Create a named tuple to make this easier to read | |
from collections import namedtuple | |
class Device(namedtuple("Device","SerialNumber, Model")): | |
@property |
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
#requires selenium to be installed | |
from selenium import webdriver | |
from selenium.webdriver.common.by import By | |
from selenium.webdriver.common.keys import Keys | |
browser = webdriver.Chrome() | |
browser.implicitly_wait(10) | |
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
[{'bounds': {'northeast': {'lat': 40.430949, 'lng': -79.4168062}, | |
'southwest': {'lat': 36.8210231, 'lng': -81.74095539999999}}, | |
'copyrights': 'Map data ©2019 Google', | |
'legs': [{'distance': {'text': '416 mi', 'value': 669988}, | |
'duration': {'text': '7 hours 3 mins', 'value': 25362}, | |
'end_address': '861 Callands Rd, Chatham, VA 24531, USA', | |
'end_location': {'lat': 36.8210231, 'lng': -79.4168062}, | |
'start_address': '37905 Crimm Rd, Scio, OH 43988, USA', | |
'start_location': {'lat': 40.4032386, 'lng': -81.1027331}, | |
'steps': [{'distance': {'text': '0.2 mi', 'value': 251}, |
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 JokeSpider(scrapy.Spider): | |
name = "quotes" | |
start_urls = ["https://onelinefun.com/puns/"] | |
def parse(self, response): | |
for joke in response.xpath("/html/body/div/article/div/p/text()").getall(): | |
yield {"joke": joke.replace("\n", " ").replace("\r", "")} | |
next_page = response.xpath("/html/body/div/article/div/a/@href").get() | |
if next_page is not None: | |
yield response.follow(next_page, self.parse) |
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 os | |
import pymongo | |
from pymongo import MongoClient | |
from redis_jobs import JobKeys | |
from .saved_workbook import SavedWorkbook | |
MONGO_HOST = os.environ.get("DB_HOST", 'localhost') |
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 xlwings as xw | |
import msoffcrypto | |
import xlrd | |
from os import listdir, remove | |
from os.path import isfile, join | |
SEARCH_FOLDER = r'C:\Users\jimmv\Desktop\vv' | |
def get_start_of_filename_from_row(row): |
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
def log(msg): | |
while True: | |
rh.reload() | |
version = rh.version | |
rh.log.append(str(msg))) | |
rh.version = version + 1 | |
try: | |
rh.save(save_condition={'version': version}) | |
break | |
except OperationError: |
OlderNewer