Problem: – You have several CSV file that have a title that needs to change. In my example I had a column name that was need to change from “Time(edt)” to just “Time” To run a test: note: no special backslash needed for “(” or “)” You can glob the files and it will do all of them. sed ‘s/Time(edt)/Time/g’ […]
Use sed command to change column names in csv files
ping: socket: Operation not permitted
Got error with Debian Bullseye jon2allen@lamp2c$ ping www.yahoo.com ping: socket: Operation not permitted to allow all users to ping again echo “0 2147483647” > /proc/sys/net/ipv4/ping_group_range to make permanent echo “net.ipv4.ping_group_range = 0 2147483647” >> /etc/sysctl.conf Here is where it is documented https://lore.kernel.org/lkml/20110518174959.GA6019@albatros/ https://www.kernel.org/doc/Documentation/networking/ip-sysctl.txt
Bitnami VM – how to enable SSH for password ( notes )
There is a special procedure. ( debian ) SSH is disabled by default. If you download a VM from bitnami sudo rm -f /etc/ssh/sshd_not_to_be_run sudo systemctl enable ssh sudo systemctl start ssh So, to enable password. edit /etc/ssh/sshd_config Uncomment the password field # To disable tunneled clear text passwords, change to no here! PasswordAuthentication yes #PermitEmptyPasswords no To add a […]
Script to create a KVM bridge in Fedora 35
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 […]
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()