Friday 25 October 2024

MYSQL how to store large binary object like file binary

  BLOB


https://stackoverflow.com/questions/13435187/what-is-difference-between-storing-data-in-a-blob-vs-storing-a-pointer-to-a-fi

According to MySQL manual page on Blob, A BLOB is a binary large object that can hold a variable amount of data.

Friday 4 October 2024

ubuntu /boot drive full

 https://askubuntu.com/questions/89710/how-do-i-free-up-more-space-in-boot

How do I free up more space in /boot?


One command to show all kernels and headers that can be removed, excluding the current running kernel:

kernelver=$(uname -r | sed -r 's/-[a-z]+//')
dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve $kernelver

udo apt-get purge $(dpkg -l linux-{image,headers}-"[0-9]*" | awk '/ii/{print $2}' | grep -ve "$(uname -r | sed -r 's/-[a-z]+//')")

Tuesday 1 October 2024

regex 101, python3 recursively replace single quote inside of double quote

 import re


# Input string

input_str = [{'a': 'b', 'c': "ddd'sss", 'x': "text'with'quotes"}]

input_str = str(input_str)


# Regex pattern to find double quotes and then identify single quotes inside

pattern = r'("([^"]*?)\'([^"]*?)")'


# Replace single quotes with <test> inside double quotes using a lambda function

fixed_output_str = re.sub(pattern, lambda m: m.group(1).replace("'", "<test>"), input_str)


# Displaying the result

print("Output string with single quotes replaced:", fixed_output_str)

python3 sandbox

 https://trinket.io/embed/python3



Wednesday 18 September 2024

DKIM DomainKeys Identified Mail

sending server publishe public key in DNS 

sending server use private key to sign a singuare to email send to receving server



receving server grabs public key from sending server's DNS

use public key to verify sending server signature 



https://www.fastcomet.com/kb/enable-dkim-and-spf-records?psafe_param=1&utm_id=gy.search.usca&utm_source=google&utm_medium=cpc&utm_campaign=21034175404_159447262216&utm_term=g_dsa-391668958313__&utm_content=691145754903&locationid=9001529&device=c_c&gad_source=1&gclid=EAIaIQobChMIv_KWgdnNiAMVag6tBh3o8A26EAAYAyAAEgIoLvD_BwE

Python change response content to JSON


https://stackoverflow.com/questions/16877422/whats-the-best-way-to-parse-a-json-response-from-the-requests-library

by default python 

response object saves actual resposne in "data"

https://www.geeksforgeeks.org/response-json-python-requests/


you can use response.json() to get the "data" list / object

to get everything:

 import json

import requests

response = requests.get(...)
json_data = json.loads(response.text)

// conver list to json string
json.dumps()

// convert json string to list
json.loads