This will enable the guest machines to get an address for the local lan ( home network ). You put in bridged in the KVM config and device is “br0” #!/bin/sh export MAIN_CONN=enp5s0f0 bash -x <<EOS systemctl stop libvirtd nmcli c delete “$MAIN_CONN” nmcli c delete “Wired connection 1” nmcli c add type bridge ifname br0 autoconnect yes con-name br0 […]
Script to create a KVM bridge in Fedora 35
VNC to Fedora 35 – left and right parentheses not working in Virt-Manager machines
Discovered a problem with x11vnc and Fedora 35. I have disabled Wayland. Each virtual machine couldn’t register left parentheses or right ( “(” and “)” ). this is through UltraVNX or TigerVNC. However, could do locally. Fix for this is follows – on the machine running x11vnc – set the x binding as such xmodmap -e “keycode 187 = Shift_L […]
Python Pandas – how to copy dtypes to a new dataframe copy.
obs1 is the source dataframe “astype” actually copies the dataframe with type data and column data new_data = obs1.astype(obs1.dtypes.to_dict()) new_data = new_date[0:1,:]
How to kill all vscode process on remote Linux server
If you disconnect vscode from a linux server. You will see all these node tasks that vscode uses. root@lamp ~# ps -ef | grep vscode root 8966 28764 0 15:11 pts/2 00:00:00 grep –color=auto vscode jon2all+ 22881 1 0 Apr28 ? 00:00:00 sh /home/jon2allen/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/server.sh –start-server –host=127.0.0.1 –enable-remote-auto-shutdown –port=0 –connection-secret /home/jon2allen/.vscode-server/.f4af3cbf5a99787542e2a30fe1fd37cd644cc31f.token jon2all+ 22889 22881 0 Apr28 ? 00:06:02 /home/jon2allen/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/node /home/jon2allen/.vscode-server/bin/f4af3cbf5a99787542e2a30fe1fd37cd644cc31f/out/vs/server/main.js –start-server […]
Bash script to check SSL expiration
Script you can run in a cron Several thing of note: when getting the SSL information – you have to echo a “q” because the openssl is interactive. To covert from timestamp to formatted date – use the @ symbol date -d @$timestamp_item ‘+%Y-%m-%d’ #!/bin/bash TARGET=”www.website.net”; RECIPIENT=”admin@websit.net”; DAYS=7; echo “checking if $TARGET expires in less than $DAYS days”; ssl_out=$(echo […]
Python – how to construct SQL with “AND” and “OR” with LIKE
def run_query_table_multi( search, and_flag=False ): if and_flag is True: combo = ” and ” else: combo = ” or ” try: conn = mariadb.connect( user=self.user, password=self.password, host=self.host, port=self.port, database=self.database ) except mariadb.Error as e: print(f”Error connecting to MariaDB Platform: {e}”, e) sys.exit(1) # Get Cursor cur = conn.cursor() my_sql_qry = “SELECT rec_id, title, http from recipe where” q_bld = “” […]
Python3 – strip html tags from string
Here is a code snippet to strip tags and leading and trailing whitespace def remove_html_tags text): “””Remove html tags from a string””” clean = re.compile(‘<.*?>’) ntxt = re.sub(clean, ”, text ) return ntxt.strip()
Updating Jessie Debian in 2022
I had this old Virtual machine running Jessie. Turnkey Linux/Debian root@TurnkeyLamp apt/sources.list.d$ uname -a Linux TurnkeyLamp 3.16.0-6-amd64 #1 SMP Debian 3.16.56-1+deb8u1 (2018-05-08) x86_64 GNU/Linux In order to update add check-valid-until=no to the archive Debian repository deb http://archive.turnkeylinux.org/debian jessie main deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main deb http://httpredir.debian.org/debian jessie main deb http://httpredir.debian.org/debian jessie contrib # deb http://httpredir.debian.org/debian jessie non-free Stack exchange link
Python – how to get the lastest file of glob by date
Use Sorted with a key for getmtime pop off the last one and that is your file import os,glob my_xlsm = sorted(glob.glob(r”C:\Users\jibsheet\Downloads\Sample*.xlsm”), key=os.path.getmtime ) latest_xlsm = my_xlsm.pop()
Python script to find extensions in directory
Here is a way to find out what type of windows extensions. pictures in this case. Count how many of each. import os ext_count = dict() my_root = r”C:\Users\jonallen\Pictures” # some dir to start in for root, dirs, files in os.walk(my_root): for file in files: pathname, exten = os.path.splitext(file) if exten in ext_count.keys(): ext_count[exten] += 1 else: ext_count[exten] = […]