Skip to content

Instantly share code, notes, and snippets.

weshouman /
Created April 11, 2024 17:02 — forked from briansmith/
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 /
Last active March 22, 2024 23:50
Using Chart.js in Trilium tutorial files
weshouman /
Last active March 5, 2024 13:26
jira panel colors

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

weshouman /
Last active January 5, 2024 15:36
Sinon structured fake clock

Testing in Both Real and Fake Time in Javascript

The code shows how to jump between the fake and real time allowing to:

  • Execute real-time dependent stubs (in real time), in this scenario it's the HIL simulation.
  • Execute long test in time controlled manner (in fake time), in this scenario it's the HIL test.

Current Implementation

Avoid using await Promise.resolve() by ticking asynchronously, for example using fakeClock.tickAsync() and then you could move between fake and real time, the code is updated to show this solution.

weshouman /
Created December 2, 2023 08:31
vim tips and tricks ep001

Using a macro to add double quotations over multiple lines in vim

  1. Select the Lines of Interest:

    • Move the cursor to the start of the first line where you want to perform the operation.
    • Enter Visual Line mode by pressing Shift+V.
    • Use the up or down arrow keys to extend the selection to cover all lines of interest.
  2. Start Recording the Macro:

    • Press q followed by a letter (like a) to start recording the macro into register a.
weshouman /
Last active December 20, 2023 11:15
Nautilus meld extension

This gist is now packaged and maintained at weshouman/nautilus-meld-compare-extension

Nautilus Meld Extension


This Nautilus extension allows us to easily compare files and directories using the Meld comparison tool directly from the Nautilus context menu.

weshouman /
Last active September 29, 2023 08:13
A python wrapper to show differences using custom tools
import unittest
import tempfile
import subprocess
# One could use vimdiff, meld, or even diff
def diff_with(test_func=None, tool='vimdiff'):
# The decorator was used with parentheses
# thus the test_func is not set, we need to call it ourself
if test_func is None:
return functools.partial(diff_with, tool=tool)
weshouman /
Last active September 9, 2023 16:59
Cilium documentation summary
weshouman /
Last active April 10, 2024 23:46
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 /
Last active October 4, 2023 07:18
apt tips and tricks

apt configurations are located in /etc/apt/ following is a breakdown for the different directories

Main Components

  1. sources.list: This is the main list of repositories that APT will use for software package management. Each line in this file specifies a different repository. Ref: man 5 sources.list

  2. sources.list.d/: This directory allows you to add additional repository lists without modifying the main sources.list file. Each file in this directory should end with .list and contain one or more repository lines, just like the main sources.list file. Ref: man 5 sources.list