Skip to content

Instantly share code, notes, and snippets.

@weshouman
weshouman / README.md
Created March 17, 2024 12:03
Recovering WD SA510 Firmware 5215100

Recovering WD SA510 Firmware 52015100

Issue

WD SA510 defaults to having firmware version 52015100 which self-destructs itself, preventing further access to the drive and preventing updating it.

Failing Attempts

Following attempts were tried and failed

  • Reading the data under Linux (some partitions showed some dir others did not)
@weshouman
weshouman / README.md
Last active October 19, 2024 04:07
eBPF tips and tricks

The eBPF (Extended Berkeley Packet Filter) language is a low-level assembly-like language that is specifically designed for writing programs that can be loaded into the Linux kernel. These programs are typically used for networking, security, and observability tasks.

eBPF has its own domain-specific language (DSL), following are some information about it.

Characteristics of eBPF DSL:

  1. Low-Level: The language is closer to assembly than to high-level languages like C.

  2. Limited Instructions: eBPF has a limited set of instructions to ensure that programs are safe to run in the kernel space.

@weshouman
weshouman / README.md
Last active September 1, 2024 22:57
Advanced mocking tips for builtins.open in python

Basic Mocking with mock_open

The simplest approach is to use mock.mock_open to simulate reading from a file. This method works well when one only needs a single return value.

import unittest
from unittest import mock
@weshouman
weshouman / 1-simple.mk
Last active August 28, 2024 13:59
Makefile function example
PATH = /tmp/
define myfn
processed_input=${PATH}/$(2)
$(1) := $$(processed_input)
endef
mytarget:
$(eval FILE=myfile)
$(eval $(call myfn,abs_filename,$(FILE)))
@weshouman
weshouman / Makefile
Last active June 8, 2024 18:57
arduino cli tips
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 / remove_containers_by_image.sh
Last active May 4, 2024 09:58
Remove containers of a given image name
#!/usr/bin/env bash
remove_containers_by_image() {
local image_name=""
local dry_run=false
# Local function to display help
display_help() {
echo "Usage: ${FUNCNAME[1]} [-h|--help] [-n|--dry-run] [-i|--image IMAGE_NAME]"
echo ""
@weshouman
weshouman / how-to-generate-and-use-private-keys-with-openssl-tool.md
Created April 11, 2024 17:02 — forked from briansmith/how-to-generate-and-use-private-keys-with-openssl-tool.md
How to generate & use private keys using the OpenSSL command line tool

How to Generate & Use Private Keys using OpenSSL's Command Line Tool

These commands generate and use private keys in unencrypted binary (not Base64 “PEM”) PKCS#8 format. The PKCS#8 format is used here because it is the most interoperable format when dealing with software that isn't based on OpenSSL.

OpenSSL has a variety of commands that can be used to operate on private key files, some of which are specific to RSA (e.g. openssl rsa and openssl genrsa) or which have other limitations. Here we always use

@weshouman
weshouman / README.md
Last active March 22, 2024 23:50
Using Chart.js in Trilium tutorial files
@weshouman
weshouman / openstack_study.md
Last active March 15, 2024 09:51
Openstack study topics

Rapid dive resource

  • Take a look at this list, it has the namings clearly stated within a multi-part guide for setting up openstack, alongside with the system requirements.

Component Documentation

General Introduction resources

For basic understanding of the functionality, following are some useful resources.

  • OpenStack's demo videos, is a good collection for different videos.
@weshouman
weshouman / README.md
Last active March 5, 2024 13:26
jira panel colors

jira supports 5 colors for the panels that could be created programmatically

{panel:title=BlueDefault}
{panel}
{panel:title=Green|bgColor=e3fce3}
{panel}
{panel:title=Purple|bgColor=f3f0ff}
{panel}
{panel:title=Orange|bgColor=fff7d6}
{panel}