This file contains hidden or 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 subprocess import Popen, PIPE | |
import os, time, datetime | |
cwd = os.getcwd() | |
ACROBAT = "C:\Program Files\Adobe\Acrobat DC\Acrobat\Acrobat.exe" | |
PDF = os.path.join(cwd, 'sample.pdf') | |
TEMP_FILE = os.path.join(cwd, 'Temp.html') | |
from pyhtml2pdf import converter | |
HTML = """ |
This file contains hidden or 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
#!/usr/bin/env python3 | |
#pip install kivy and pyModbusTCP | |
__version__ = '1.0' | |
import kivy | |
kivy.require('2.2.0') | |
from kivy.app import App | |
from kivy.clock import Clock |
This file contains hidden or 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
""" | |
!add this to the switch config: | |
snmp-server community public RO | |
snmp-server location in some closet | |
snmp-server contact [email protected] | |
""" | |
from pysnmp.hlapi import * |
This file contains hidden or 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
#!/usr/bin/env python3 | |
import socket, struct, time | |
from pycomm3.packets.base import ResponsePacket, RequestPacket | |
from pycomm3.packets.ethernetip import RegisterSessionResponsePacket, DataItem | |
from pycomm3.cip.services import Services, EncapsulationCommands | |
class CIPServer(object): | |
def __init__(self) -> None: | |
super().__init__() |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<RSLogix5000Content SchemaRevision="1.0" SoftwareRevision="31.02" TargetType="Rung" TargetCount="1" ContainsContext="true" ExportDate="Thu May 20 03:25:02 2021" ExportOptions="References NoRawData L5KData DecoratedData Context RoutineLabels AliasExtras IOTags NoStringData ForceProtectedEncoding AllProjDocTrans"> | |
<Controller Use="Context" Name="PowerDiscreteDeviceObjects"> | |
<DataTypes Use="Context"> | |
<DataType Name="raC_UDT_Event" Family="NoFamily" Class="User"> | |
<CustomProperties> | |
<Provider ID="ACM" Ext="0"> | |
<Header xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Maj="1" Min="0" OExt="-1" UExt="1"> | |
<Libs> | |
<LibHdr CatalogNumber="raC_Dvc_AS281E" Guid="0D88D226-393F-4D0F-8F3F-B04A585A2698" /> |
This file contains hidden or 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 pyodbc | |
TICKS_PER_SEC = 10000000.0 # Factorytalk Alarm and Event ticks / sec | |
server = 'localhost\SQLEXPRESS' | |
database = 'FTVSE_AE' | |
username = 'python' # using SQL credentials | |
password = 'python_pw' | |
cnxn = pyodbc.connect('DRIVER={ODBC Driver 17 for SQL Server};SERVER='+server+';DATABASE='+database+';UID='+username+';PWD='+ password+';Trusted_Connection=no;') | |
cursor = cnxn.cursor() |
This file contains hidden or 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 sqlite3 | |
import pyodbc | |
TABLES = { | |
"FTAEInstance": """ | |
CREATE TABLE IF NOT EXISTS [FTAEInstance]( | |
[lFTAEInstanceId] [int] NOT NULL, | |
[sProduct] [varchar](255) NOT NULL, | |
[sCatalogNumber] [varchar](255) NULL, | |
[lMajorVersion] [int] NOT NULL, |
This file contains hidden or 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
const { Controller, Tag, EthernetIP } = require("ethernet-ip"); | |
const { SINT, DINT } = EthernetIP.CIP.DataTypes.Types; | |
const PLC = new Controller(); | |
const readString = (name)=>{ | |
return new Promise(async (res, rej)=>{ | |
try{ | |
str = '' |
This file contains hidden or 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 struct | |
from ctypes import * | |
import numpy as np | |
def get_timespan(fn): | |
with open(fn, "rb") as fp: | |
fp.seek(1024) | |
data = True | |
first = None | |
last = None | |
while data: |
This file contains hidden or 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
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<html> | |
<head> | |
<title>widget</title> | |
</head> | |
<body> | |
<svg width="400" height="400"> | |
<path fill="#AAA" d="M0,0 V400 H400 V0 H0" stroke="#000" stroke-width="4" /> | |
<circle stroke="#000" stroke-width="10" fill="#FFF" cx="200" cy="200" r="100"> |
NewerOlder