Skip to content

Instantly share code, notes, and snippets.

@weshouman
weshouman / gimp_img_downsize.py
Created November 29, 2020 19:17 — forked from amatelin/gimp_img_downsize.py
A simple script to automatically downsize all the images in a folder using Gimp python console (Gimp->Filters/Python-Fu/console).
from os import listdir
from os.path import isfile, join
## Set image folder path
dir_path = "C:/img_dir/"
## Store files names in folder
files = [f for f in listdir(dir_path) if isfile(join(dir_path, f))]
for file in files:
@weshouman
weshouman / README.md
Last active August 1, 2022 05:21
Wacom tips and tricks
@weshouman
weshouman / README.md
Last active June 30, 2020 10:18
Update RPI 4 Bootloader

How I update RPIs bootloader

Prerequisits

  • Get an extra sd-card for flashing updates

Setup

  • Flash Raspberry OS (used the minimal version) into the sd-card using balena-etcher
  • Using sudo run touch /mnt/.../boot/ssh to enable ssh login to the rpi
  • Move the sd-card to the RPi
  • Debug hint: from now on use the following to get the different versions /opt/vc/bin/vcgencmd version or vcgencmd bootloader_version or event vgencmd bootloader_config.
@weshouman
weshouman / README.md
Created May 31, 2020 14:28
A guide to crontab

Adding jobs

  • crontab -e: then add a line representing the job

Syntax

  • @reboot sleep 60 && my_script.sh
  • 59 12 * * * simon /usr/bin/sample.sh > /dev/null 2>&1

Known issues

  • silent failures: running a job with no permission for the current user fails silently, be careful to provide sudo when needed
@weshouman
weshouman / README.md
Created April 26, 2020 04:09
git submodules walkthrough
@weshouman
weshouman / README.md
Created April 21, 2020 23:29
Gitea SSH debugging

This gist tackles, how I did debug the ssh configuration for gitea.

tl;dr: Only read to have some debugging insights, follow this issue to get the final answer directly.


First of all Gitea uses s6 to supervise sshd and gitea itself.
Which automatically resurrects sshd, whenever sshd shuts down. To rerun the sshd with some other options, hopefully over the same port, as it's the one correctly exposed through docker

@weshouman
weshouman / README.md
Last active August 23, 2020 06:42
AWK hints

Following are some hints

  • There are many flavors for awk, mawkminimal&default, gawkfeature-full & nawknew-implementation
  • For a technical comparison between mawk and gawk follow this google discussion
  • MAWK was slow, follow this guide. But the recent version 1.3.4 seems to fix that
  • AWKPATH is only available in gawk. nawk may have it too. But the default one mawk only uses the -f notation, it doesn't even havet the @inlcude statement, thus one can't nest the files, without creating a wrapper application, in a conf/lib like directory structure.
@weshouman
weshouman / README.md
Created April 2, 2020 04:51
memory hints

Hints for working with memory on linux

  • Set swappiness to zero guide
  • Utilize ps_mem to check for the real memory usage
  • Check for the caches by checking /proc/meminfo, for GB/MB view use this answer
  • Drop the caches if desired by using sudo sh -c "/bin/echo 3 > /proc/sys/vm/drop_caches" then resetting to 0, the guide is here, notice that sudo should wrap the whole redirection.
@weshouman
weshouman / README.md
Last active September 7, 2022 20:15
Automating Synology Disk Station

Following are the steps I followed to have further understanding

  1. Know the architecture from this link. Whether the API totally encapsulates the CGI or there are some differences, that is not the topic of this guide, so it's better to be always aware of the Disk Station Architecture your script would support, so that when we have to read the sources we'll know which source to check

  2. Try a working ansible role. That will give a pretty good overview of how the interaction is implemented.

  3. Check the official docs for the