Skip to content

Instantly share code, notes, and snippets.

@weshouman
weshouman / README.md
Last active August 20, 2023 20:04
Kernel module dependency walker

Those scripts are used to walk the dependencies of the Kernel Modules in Linux.

Usage

One could use any of the following implementation, either on Python or Bash

Note: The python implementation is updated to use a cache, making it instantaneous

Python Script

Use any of the following commands

@weshouman
weshouman / certificates.md
Last active June 15, 2023 08:20
python tips and tricks #python #study #tips

Motivation

When connecting to the internet we could be doing that :

  1. to install new packages/modules, or
  2. to make requests within the application, using requests module.

By either of them we could get SSLCertVerficationError, but each requires a different solution.

PIP Trust

For the first scenario, using pip to install new modules, one could configure the .ini file and add the following lines

simple:
source get_device.sh
getdevicename 1234:abcd
getdevicenum 1234:abcd
script:
#Device VENDOR ID
: ${DEVICE_VENDOR:="1234"}
#Device PRODUCT ID
: ${DEVICE_PRODUCT:="abcd"}
@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

@weshouman
weshouman / README.md
Last active August 1, 2022 05:21
Wacom tips and tricks
@weshouman
weshouman / pycom.py
Last active July 28, 2022 05:08 — forked from vlasenkov/pycom.py
win32com multithreading example
# win32com multithreading example
import sys
import time
from threading import Thread
# sys.coinit_flags has to be set before importing pythoncom and win32com, otherwise the following errors would be showing up
# - The application called an interface that was marshalled for a different thread.
# - This COM object can not automate the makepy process - please run makepy manually for this object
sys.coinit_flags = 0  # pythoncom.COINIT_MULTITHREADED == 0
@weshouman
weshouman / bare-metal.md
Last active July 2, 2022 03:03
A guide to some issues working with cloud-init

Post-Setup Modification

I was looking forward to changing the user-data available on baremetal installation of user-data on an RPI, and following are the hits that I reached.

Note: I found multiple instances of the user-data and user-data.i, but I didn't reach yet which is the source as all the ones that I changed got reverted upon a restart.

rsyslog

The warning cc_rsyslog.py:205: FutureWarning: Possible nested set at position 23 is not severe, but it shows up, it could be circumvented using version 19.1

@weshouman
weshouman / javascript_tips.md
Last active June 9, 2022 09:17
Javascript tips and tricks #study #javascript

Caution

This Gist is a WIP

Multiple variable assignment

var a, b, c;
a = b = c = 10;
alert(a + b + c)

source

@weshouman
weshouman / README.md
Last active June 9, 2022 08:49
npm common issues

NPM package installation behind a proxy

While installing yo behind proxy you may get issues as described in this issue The root cause is that yo is trying to connect to the internet while doing the sanity checks on your system using a global proxy as described here and there

I was not able to change the GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE from undefined to an empty variable from the powershell, so I edited the node_modules\got\index.js:requestAsEventEmitter(opts):~22 and added the following line

	process.env.GLOBAL_AGENT_ENVIRONMENT_VARIABLE_NAMESPACE="";
@weshouman
weshouman / VS16NoTelem.bat
Created April 28, 2022 16:55
Disable telemetry in Visual Studio 2019
@echo off
fltmc >nul 2>&1 || (
echo This batch script requires administrator privileges. Right-click on
echo the script and select "Run as administrator".
goto :die
)
rem Change this path if you are using Community or Professional editions
set "VS_INSTALL_DIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"