Skip to content

Instantly share code, notes, and snippets.

View BH1SCW's full-sized avatar

F.J Kong BH1SCW

View GitHub Profile
@jflemer-ndp
jflemer-ndp / git-rpm-changelog.sh
Last active February 3, 2024 02:08
generate a rpm spec compatible changelog from git history
#!/bin/bash
merge_commit() {
git show --no-patch --format='%P' "$@" | head -1 | grep -q ' '
}
commit_meta() {
git show --no-patch --format="* %cd %aN <%ae> - %H" --date=local "$@" | \
head -1 | \
sed -E 's/^(\* [a-z0-9 ]{9,10}) \d{2}:\d{2}:\d{2}/\1/i'

Git-Shadowsocks与git代理配置

# 设置配置

# Windows默认1080端口
git config --global https.proxy http://127.0.0.1:1080
git config --global https.proxy https://127.0.0.1:1080
@iafisher
iafisher / bookmarks_from_sql.py
Created March 9, 2019 22:54
Programmatically access your Firefox bookmarks
"""
A script to automatically export bookmarks from Firefox's SQLite database.
There does not seem to be a programmatic way to get Firefox to export its bookmarks in
the conventional HTML format. However, you can access the bookmark information directly
in Firefox's internal database, which is what this script does.
Always be careful when working with the internal database! If you delete data, you will
likely not be able to recover it.
@talkingmoose
talkingmoose / List macOS 32-bit apps.bash
Last active August 26, 2021 11:54
In preparation for macOS 10.15, this list identifies 32-bit apps in the Applications folder and returns the list to an extension attribute in Jamf Pro. The returned list may include Xcode because it contains an app with a non-standard file in place of a binary deep within its app bundle. This may be ignored.
#!/bin/bash
# create a list of paths in the Applications folder for testing
MacOSPaths=$( /usr/bin/mdfind kMDItemKind==Application )
# recurse through the list and create a list of apps with 32-bit binaries
while IFS= read aPath
do
cd "$aPath/Contents/MacOS"
@sergei-mironov
sergei-mironov / mosh-nat-server.sh
Created September 15, 2019 20:21
mosh-nat-server.sh
#!/bin/sh
RELAY="$1"
PORT="$2"
echo -n 'nat-hole-punch' | socat STDIN "UDP-SENDTO:$RELAY:$PORT,sourceport=$PORT"
mosh-server new -p "$PORT" | sed -n 's/MOSH CONNECT [0-9]\+ \(.*\)$/\1/g p'
@isomorphisms
isomorphisms / gist:3114ab86960656a729a6b4653001aae2
Created November 27, 2019 06:08
how to pull from docker hub using podman/buildah
On void linux.
Under `/etc/containers/` there is a file called `registries.conf`. It is complemented by `man 5 containers-registries.conf`.
Change (for me lines 11-12) which say
[registries.search]
registries = []
@rikka0w0
rikka0w0 / pxe_tftp_openwrt.md
Last active October 21, 2025 23:12
PXE on OpenWrt with a different TFTP server

In this configuration, DHCP will run on the OpenWrt Box, while the TFTP server (the one serves the boot files) runs on a different computer.

1. Add to /etc/config/dhcp on OpenWrt Box

config boot linux
        option filename 'pxelinux.0'
        option serveraddress '192.168.?.?'
        option servername '?'
@ganapathichidambaram
ganapathichidambaram / centos-8_custom_iso_creation.md
Created January 13, 2020 09:50
Creation of CentOS-8 Custom ISO

ISO Creation from Scratch

In this tutorial we are going to look into creation of CentOS ISO based on CentOS 8. There are few slight difference between the folder structure from CentOS 7. In CentOS 7 isolinux contains directly Packages without any parent folder and every rpm will be under single folder. But in CentOS 8 it would segreagated into two separate folder such as BaseOS and AppStream. And those configuration defined on media.repo file present in the iso file.

  • To Create ISO we need to create necessary folder struture like mentioned below.
mkdir -p ~/kickstart_build/isolinux/{BaseOS,AppStream}/Packages
@vegard
vegard / kernel-dev.md
Last active October 1, 2025 06:07
Getting started with Linux kernel development

Getting started with Linux kernel development

Prerequisites

The Linux kernel is written in C, so you should have at least a basic understanding of C before diving into kernel work. You don't need expert level C knowledge, since you can always pick some things up underway, but it certainly helps to know the language and to have written some userspace C programs already.

It will also help to be a Linux user. If you have never used Linux before, it's probably a good idea to download a distro and get comfortable with it before you start doing kernel work.

Lastly, knowing git is not actually required, but can really help you (since you can dig through changelogs and search for information you'll need). At a minimum you should probably be able to clone the git repository to a local directory.

@RahulDas-dev
RahulDas-dev / Sqlx_Sqlite.rs
Last active February 17, 2023 07:57
Sqlx::Sqlite Integration with Rust
/*
[dependencies]
sqlx = { version = "0.5.9", features = [ "runtime-async-std-native-tls", "sqlite" ] }
async-std = { version = "1.6", features = [ "attributes" ] }
futures = "0.3.18"
*/
use std::result::Result;
use sqlx::{sqlite::SqliteQueryResult, Sqlite, SqlitePool, migrate::MigrateDatabase};