Skip to content

Instantly share code, notes, and snippets.

Avatar

F.J Kong BH1SCW

View GitHub Profile
@BH1SCW
BH1SCW / Calling_C_From_Rust.md
Created Jun 13, 2022 — forked from hempnall/Calling_C_From_Rust.md
Calling C++ code from Rust
View Calling_C_From_Rust.md

Start off with some Rust source code

hw.rs :

#[link(name = "extern")]
extern {
	fn hello();
}

@BH1SCW
BH1SCW / gpgcryptic.txt
Created Apr 29, 2022 — forked from cliffano/gpgcryptic.txt
gpg cryptic errors
View gpgcryptic.txt
I started getting the error below after upgrading to gpg (GnuPG) 2.1.21 .
gpg: signing failed: Timeout
gpg: signing failed: Timeout
This was confusing at first, but the timeout was caused by gpg showing a password prompt that takes the full screen of the terminal, and after a period of time, it returned to the command line showing the timeout error.
I didn't notice the password prompt at first because I was working on multiple terminals and only saw the timeout error at the end.
Another error that I encountered earlier was:
@BH1SCW
BH1SCW / mosh-nat-server.sh
Created Apr 28, 2022 — forked from grwlf/mosh-nat-server.sh
mosh-nat-server.sh
View 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'
@BH1SCW
BH1SCW / gist:6d8480f85ec8e796c3fa3d81f8e1133c
Created Apr 28, 2022 — forked from kwilczynski/gist:dc69ed5acb27a19ec1e29914895d7666
Install lei for kernel development using lore directly on Ubuntu
View gist:6d8480f85ec8e796c3fa3d81f8e1133c
apt install -y vim
apt install -y wget
apt install -y sqlite3 (used by a test, not needed for the build to complete)
apt install -y curl
apt install -y git
apt install -y build-essential
apt install -y pkg-config
@BH1SCW
BH1SCW / gist:94d4f43c62cdc4a6f57066e4e274472b
Created Apr 12, 2022 — forked from Cyan4973/gist:5b835641c134b8d6e7c3
Takayuki's Streaming example 2 (simplified)
View gist:94d4f43c62cdc4a6f57066e4e274472b
// LZ4 streaming API example 2 (ring buffer)
#define _CRT_SECURE_NO_WARNINGS // for MSVC
#include "lz4.h"
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
@BH1SCW
BH1SCW / Uninstall-pkg.md
Created Mar 25, 2022 — forked from githubutilities/Uninstall-pkg.md
Uninstall pkg manually in OS X
View Uninstall-pkg.md

Mac Uninstall pkg Manually

  • using pkgutil
# list all your installed packages
pkgutil --pkgs

# show your package info
pkgutil --pkg-info 
@BH1SCW
BH1SCW / arm64.md
Created Jan 19, 2022 — forked from george-hawkins/arm64.md
Running virtualized x86_64 and emulated arm64 Ubuntu cloud images using QEMU
View arm64.md

QEMU arm64 cloud server emulation

This is basically a rehash of an original post on CNXSoft - all credit (particularly for the Virtio device arguments used below) belongs to the author of that piece.

Download the latest uefi1.img image. E.g. ubuntu-16.04-server-cloudimg-arm64-uefi1.img from https://cloud-images.ubuntu.com/releases/16.04/release/

Download the UEFI firmware image QEMU_EFI.fd from https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/

Determine your current username and get your current ssh public key:

@BH1SCW
BH1SCW / gist:aa038b889dd10d8c24b4bb6647fe835d
Created Jan 17, 2022 — forked from brandonros/gist:9086f20135233b1fcf10212cc0830d31
OBD-II data/parameter identifier groups to log for ECU tuning
View gist:aa038b889dd10d8c24b4bb6647fe835d
1. general (rpm, speed, gear, time)
2. engine load (actual + target)
3. torque (actual + target)
4. accelerator pedal angle
5. throttle body angle
6. boost (actual + target)
7. wastegate duty cycle
8. fuel trims (short term)
9. fuel pressure (low + high)
10. ignition timing (all cylinders + average)
View update-alternatives-clang.sh
#!/usr/bin/env bash
# --slave /usr/bin/$1 $1 /usr/bin/$1-\${version} \\
function register_clang_version {
local version=$1
local priority=$2
update-alternatives \
--install /usr/bin/llvm-config llvm-config /usr/bin/llvm-config-${version} ${priority} \
@BH1SCW
BH1SCW / clash.service
Created Dec 19, 2021 — forked from akillcool/clash.service
clash auto start and update subcribe configuration
View clash.service
# edit and save this file to /usr/lib/systemd/system/clash.service
[Unit]
Description=clash
After=network.target
[Service]
WorkingDirectory="your home directory"/.config/clash
ExecStart="your home directory"/.config/clash/start-clash.sh
ExecStop="your home directory"/.config/clash/stop-clash.sh
Environment="HOME=your home directory"