Skip to content

Instantly share code, notes, and snippets.

Avatar

Walid Shouman weshouman

  • Stuttgat, Germany
View GitHub Profile
@weshouman
weshouman / Makefile
Last active Dec 26, 2020
arduino cli tips
View Makefile
VERSION=0.14.0
SPECIFIER=arduino-cli_${VERSION}_Linux_64bit
BINDIR=/usr/local/bin/
# - Avoid redownloading
# - Avoid overwriting
# - To overwrite, use make uninstall
install:
TMPDIR=/tmp/$(SPECIFIER) && \
mkdir -p $${TMPDIR} && \
@weshouman
weshouman / gimp_img_downsize.py
Created Nov 29, 2020 — 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).
View gimp_img_downsize.py
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 Jun 30, 2020
Update RPI 4 Bootloader
View README.md

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
A guide to crontab
View README.md

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 Apr 26, 2020
git submodules walkthrough
View README.md
@weshouman
weshouman / README.md
Created Apr 21, 2020
Gitea SSH debugging
View README.md

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

View README.md

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.
View README.md

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 Feb 25, 2021
Automating Synology Disk Station
View README.md

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