Posts

[Python] PyQt Threads

Image
  Define the Thread: class ThreadWorker(QThread): updateValueSignal = pyqtSignal( str ) updateTextEditSignal = pyqtSignal( str ) def run ( self ): #self.updateTextEditSignal.emit("Started MODBUS Read...\r\n\r\n") self .updateTextEditSignal.emit( "emit text signal" ) print ( "emit text signal" ) #buttonReply = QMessageBox.question(self, 'READ PASS', f"Reading from {modbus_ip} > Serial no.: {regs[0]}", # QMessageBox.Ok) def stop ( self ): self .terminate() Running the thread: def RunThread ( self ): self .threadworker = ThreadWorker() #self.threadworker.updateValueSignal.connect(self.showdialog) self .threadworker.updateTextEditSignal.connect( self .updateText) # self.modbusworker.updateListSignal.connect(self.updateList) self .threadworker.start()

[RPi] Setting up a NAS with openmediavault and Plex Media Server

Image
  What you need: Raspberry Pi 4 External Hard Drive STEP 1  Raspberry Pi Imager:  https://www.raspberrypi.org/software/ Update your Pi sudo apt update && sudo apt upgrade STEP 2 - Install OpenMediaVault Run this command: wget -O - https://raw.githubusercontent.com/OpenMediaVault-Plugin-Developers/installScript/master/install | sudo bash INSTALL PLEX MEDIA SERVER Install the https-transport package sudo apt-get install apt-transport-https Add the Plex repositories curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add - echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list sudo apt-get update Install Plex sudo apt install plexmediaserver If this doesn't work, download the compilied binary pagckage .deb manually as explained in the artcle given here : https://www.linuxbabe.com/debian/install-plex-media-server-debian-10-buster .

[Linux] Using grep command with pattern input from a file

Image
grep <text pattern> <file to be checked> grep -f<pattern file> <file to be checked> example: grep -f pattern.txt /var/log/apache2/access.log -f to input search patterns one search pattern per line do not include space/enter empty lines at the end - it will result displaying the whole file as it has enter '\r, '\n' characters contents of pattern.txt : /admin/system-monitor/flood-protect HTTP/1.1" 200 582 /admin/system-monitor/flood-protect HTTP/1.1" 200 590

[Python] PyQt5 Message Boxes

buttonReply = QMessageBox.question( self , 'Shutdown Server' , "Shutdown Server VM, Continue?" , QMessageBox.Yes | QMessageBox.No , QMessageBox.No) if buttonReply == QMessageBox.Yes: operation_num = 2 self .operationsThread = Operations_Thread() self .operationsThread.updateTextEditSignal.connect( self .updateText) self .operationsThread.start() self .updateText( "[{}]Shutting down VM - Please wait..." .format(time.strftime( "%Y.%m.%d-%H:%M:%S" ))) def showdialog ( self , text): global mon_config if text != 'FAIL' : msg = QMessageBox() msg.setIcon(QMessageBox.Information) msg.setWindowTitle( f"MODBUS TCP Read from: { self .selectedDevice } " ) msg.setText( f"Sensor serial no: { text } " ) msg.setInformativeText( "For more info. click 'Show Details'" ) msg.setDetailedText( f"Serial no. from IP address : { self .selectedDevic...

[Linux] View Command Line Histroy on a Linux Computer

List quickly go by with the last 500 commands used on a Linux terminal $ history 

[Linux] Changing Host Name of a Linux Computer

  Edit following files :  Edit  /etc/hostname Edit  /etc/hosts  To view the host name: use  hostname  command 

[Linux] tcpdump - view TCP traffic on Linux

View contents of TCP packet in LINUX : using tcpdump command only shows packets from a specific IP address                 tcpdump src 192.168.5.29 -X  only shows packets to and from specific IP address                 tcpdump host 192.168.5.29 -X  display packets to and from a specific IP address              tcpdump -X dst 192.168.0.122 or src 192.168.0.122  specify interface -i ens33            tcpdump -i ens33 -X dst 172.19.176.145 or src 172.19.176.145     tcpdump -i ens33 -X dst 10.44.57.129 or src 10.44.57.129  display only tcp packets sent from src to dst ip address      tcpdump -i ens33 -X dst 10.44.63.130 and src 10.44.63.229  capture only POST requests on specified network interface '-i ens33'      tcpdump -i ens33 -s 0 -A 't...