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 time, struct | |
import numpy as np | |
import matplotlib.pyplot as plt | |
path = 'E:/big_ass.rdd' | |
ptr = 0 | |
np_ptr = 0 | |
buff = np.zeros([2,2000000], np.float64) | |
t = time.time() | |
with open(path, 'rb') as f: |
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 scipy.interpolate import interp1d | |
import numpy as np | |
old_time = np.linspace(0, 10, num=11, endpoint=True) | |
old_vals = np.sin(old_time) | |
f = interp1d(old_time, old_vals) | |
f2 = interp1d(old_time, old_vals, kind='cubic') | |
new_time = np.linspace(0, 10, num=1000, endpoint=True) |
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
#local ip is 10.10.10.11 | |
#PLC ip is 10.10.10.10 | |
#route setup on PLC's ADS router AmsNetID 10.10.10.11.1.1 and IP 10.10.10.11 | |
import gi, shutil, os | |
import pyads | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk, GObject, Gdk | |
def setup_ads(): |
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"> |
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
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 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
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
<?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
#!/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__() |
OlderNewer