See more details here https://r4ven.fr/en/blog/ubuntu-compress-pdf-nautilus/
useful_stuff.get_all()
I hope you find this useful!
Tuesday, December 16, 2025
Monday, December 15, 2025
updating fonts in ubuntu
To bulk install fonts in Ubuntu, copy font files (.ttf, .otf) to ~/.local/share/fonts/ (for your user) or /usr/share/fonts/ (system-wide), then run fc-cache -fv in the terminal to update the font cache, or use the graphical Font Manager by dragging and dropping them in.
Thursday, December 11, 2025
non-blocking network calls when using asyncio in python
To avoid blocking your Event Look in Python when using asyncio, do not use `requests` but use `aiohttp`
Here is some example code. `aiohttp` gives us a session that works well on the asyncio Event Loop.
import aiohttp
import asyncio
async def fetch_real_url(session, url):
async with session.get(url) as response:
return await response.text()
async def main():
async with aiohttp.ClientSession() as session:
urls = ['http://python.org', 'http://google.com', 'http://example.com']
# Create a list of tasks
tasks = [fetch_real_url(session, url) for url in urls]
# Run them all at once
responses = await asyncio.gather(*tasks)
print(f"Downloaded {len(responses)} pages concurrently.")
if __name__ == "__main__":
asyncio.run(main())
Other useful things...
- `async` returns a coroutine object that can be scheduled.
- Calling this function returns a `future` — a placeholder for a result that hasn't happened yet. It tracks the state (Pending, Finished, Cancelled).
- The Event Loop is single-threaded. The Event Loop serves as a scheduler of these tasks.
Saturday, July 1, 2023
Tuesday, June 27, 2023
SSH returns: no matching host key type found. Their offer: ssh-dss
Fix is
ssh -oHostKeyAlgorithms=+ssh-dss root@192.168.8.109
Read more here https://askubuntu.com/questions/836048/ssh-returns-no-matching-host-key-type-found-their-offer-ssh-dss Wednesday, June 21, 2023
format decimal and doubles in Java to desired decimal places
To format numbers in java, simple
String.format("%.2f", 132.2372342)
Wednesday, May 12, 2021
Free up space in ubuntu server
Clean old kernels
- Check for kernet is use : uname –r
- Check for old kernels : dpkg --get-selections | grep linux-image
- Remove unused kernels : dpkg --get-selections | grep linux-image
Clean APT (Pulled from https://askubuntu.com/questions/5980/how-do-i-free-up-disk-space)
- To delete downloaded packages (.deb) already installed (and no longer needed)
- sudo apt-get clean
- To remove all stored archives in your cache for packages that can not be downloaded anymore (thus packages that are no longer in the repository or that have a newer version in the repository).
- sudo apt-get autoclean
- To remove unnecessary packages (After uninstalling an app there could be packages you don't need anymore)
- sudo apt-get autoremove
Finally, Check Disk Space
- df -h /
Subscribe to:
Comments (Atom)