Skip to content

Instantly share code, notes, and snippets.

How to Enable SMB1/NT1 per Client IP in Samba — Use config file Instead of include

Starting with Samba 4.20, administrators have reported that using include = /etc/samba/smb.conf.%I does not reliably apply settings like server min protocol = NT1. The reason is that protocol negotiation happens at the very start of the connection, before the include file is loaded. As a result, even if you specify NT1 in the per-IP include file, the server has already locked onto the global default (SMB2_02 or higher), and the client will fail with “No protocol supported”.

This article explains why this happens and how to fix it using config file = %I.


Why include Fails for server min protocol

Managing Default Kernels with Grubby on Linux

When working with Linux systems that support multiple kernel versions, it’s often useful to manage which kernel is selected by default at boot. The grubby utility provides a convenient command-line interface for viewing available kernels, checking or changing the default kernel, and managing boot indexes. This article explains how to perform these operations step by step.


Checking the Kernel List

To view all available kernel entries that grubby knows about, run:

Extracting and Securing PEM Files

When working with PEM files that contain both a certificate and a private key, you often need to split them and optionally protect the key with a password.


1. Split Certificate and Private Key

  • Extract the certificate:

How to Stop Windows from Waking Up Automatically and Draining Your Battery

One frustrating issue many laptop users face is Windows waking up unexpectedly from sleep and draining the battery. Fortunately, you can take control of wake timers, scheduled maintenance, and related settings to prevent this behavior. This guide walks you through the process step by step.


1. Check Active Wake Timers

First, you need to confirm what is currently set to wake up your PC. Open a command prompt with administrator privileges and run:

bcache vs. lvmcache — Are users rating them the same?

Summary: No — they are not rated the same. Looking across the community, lvmcache (dm-cache) is frequently favored for “LVM integration, operational ease, mature tooling, and production track record,” while bcache wins praise for “high performance under the right conditions and the flexibility to cache multiple HDDs with a single SSD.” Users who prioritize conservative, large-scale, stable operation tend to prefer lvmcache; users who want peak performance or one-SSD-to-many-HDD caching pick bcache.


What divides user opinion (community voices and official docs)

  • Production / large-scale reports

Forcing SMB1 with smbclient

$ smbclient //HOST/SHARE -U USER -m NT1 --option='client min protocol=NT1'

This short command tells the Samba smbclient tool to connect to a remote SMB/CIFS share using the SMB1 (NT1) protocol dialect. //HOST/SHARE is the UNC path to the server and share, and -U USER supplies the username for authentication. ([samba.org][1])

Flag breakdown:

  • -m NT1 (or --max-protocol=NT1 in some docs) forces the client to use the NT1 dialect (SMB1) when negotiating with the server. This overrides the default behavior of negotiating the highest mutually supported SMB version. ([samba.org][1])
  • --option='client min protocol=NT1' sets the equivalent Samba client configuration option at runtime, lowering the minimum protocol the client will attempt; this makes smbclient accept SMB1-only servers. The same setting can be placed in /etc/samba/smb.conf under [global]. ([samba.org][2])

Disable Extra Suggestions on Mistyped Commands in Bash

When you run:

unset -f command_not_found_handle

you are removing Bash’s special function that normally catches typos or missing commands.

A quick way to serve local https server

Generate self-signed cert files

openssl genpkey -algorithm RSA -out key.pem
openssl req -new -key key.pem -out cert.csr -subj "/C=JP/ST=Tokyo/L=Chiyoda/O=Example Inc./CN=localhost"
openssl x509 -req -in cert.csr -signkey key.pem -out cert.pem -days 365

Python embed example

📘 How to Retrieve GitHub Release Tags and Assets Programmatically Using the GitHub API

GitHub provides a comprehensive REST API that enables developers to programmatically access information about repositories, releases, and downloadable assets. This is especially useful for automating software distribution, checking version histories, or integrating with CI/CD pipelines.

Below is an explanation of how to retrieve release-related data—including specific release assets and all available tags—from a GitHub repository using various API endpoints.


🔹 1. Get the Latest Release