Skip to content

Instantly share code, notes, and snippets.

View laoshaw's full-sized avatar

Shawn X laoshaw

View GitHub Profile
@laoshaw
laoshaw / iwchan.awk
Created October 1, 2020 21:30
Select wireless channel automatically
#!/usr/bin/awk -f
# Coded by: Vladislav Grigoryev <vg[dot]aetera[at]gmail[dot]com>
# License: GNU General Public License (GPL) version 3+
# Description: Select wireless channel automatically
function get_iwphy() {
cmd = "iw phy"
while(cmd | getline) {
if($0 ~ /^\s*Wiphy\s/)
@laoshaw
laoshaw / README.md
Created December 11, 2023 04:18 — forked from stokito/README.md
CGI shell scripts samples

CGI samples

CGI Variables

Standard set of Common Gateway Interface environment variable are described in RFC3875. For example:

CONTENT_TYPE=application/x-www-form-urlencoded
GATEWAY_INTERFACE=CGI/1.1
REMOTE_ADDR=192.168.1.180
QUERY_STRING=Zbr=1234567&SrceMB=&ime=jhkjhlkh+klhlkjhlk+%A9%D0%C6%AE%C6%AE&prezime=&sektor=OP
REMOTE_PORT=2292

Bitbake Cheatsheet

Verbose as possible

bitbake -vDDD your-recipe

List recipes

bitbake -s

Automating SSH with Putty (Windows)

Putty is a tool which can be used for various purposes, including communicating with a Linux computer using SSH (Secure SHell) from a Windows computer. Given the username, hostname, and password of a Linux machine which is to be SSHed into, Putty can be automated from the command line as follows (assuming Putty is on the Windows path):

putty -ssh username@hostname -pw password

If the same user on the same Linux machine is to be accessed repeatedly, this command can be automated in Windows by creating a shortcut as follows:

  • Right click on the desktop/explorer
@laoshaw
laoshaw / svelte.md
Created January 19, 2023 18:43 — forked from peltho/svelte.md
Svelte cheatsheet
@laoshaw
laoshaw / README.md
Created January 4, 2023 21:18 — forked from vitex/README.md
A script to build Haserl 0.9.29 with LuaJIT 2.0

This script modifies the Haserl 0.9.29 distribution so it works with LuaJIT 2.0 as well as Lua 5.1. The script takes a single argument that is the path to a LuaJIT / Lua distribution directory in which library and executable files have been built. A typical usage is

    ./build-haserl-luajit.sh /usr/local/src/LuaJIT-2.0.0/

The script patches configure.ac, builds Haserl, and executes a CGI script to verify that LuaJIT / Lua is working within Haserl.

The LuaJIT distribution builds both .so and .a libraries; this script always uses the .a library so the Haserl executable contains an embedded copy of LuaJIT. If you prefer to link dynamically to LuaJIT, modify the script to change

    [ LIBS="-Wl,-Bstatic -l$LUALIB -Wl,-Bdynamic $LIBS" ]
@laoshaw
laoshaw / C-Code.md
Created September 19, 2022 20:28 — forked from Acry/C-Code.md
C-Idioms, C-Examples, C-Tutorials, C-Snippets, C-Resources
@laoshaw
laoshaw / c99_ub_list.rst
Created September 4, 2022 18:54 — forked from Earnestly/c99_ub_list.rst
C99 List of Undefined Behavior (193 Cases)

C99 List of Undefined Behavior

From N1256: (See http://port70.net/~nsz/c/c99/n1256.html#J.2)

  • A "shall" or "shall not" requirement that appears outside of a constraint is violated (clause 4).
  • A nonempty source file does not end in a new-line character which is not immediately preceded by a backslash character or ends in a partial preprocessing token or comment (5.1.1.2).
  • Token concatenation produces a character sequence matching the syntax of a universal character name (5.1.1.2).
  • A program in a hosted environment does not define a function named main using one of the specified forms (5.1.2.2.1).
  • A character not in the basic source character set is encountered in a source file, except in an identifier, a character constant, a string literal, a header name, a comment, or a preprocessing token that is never converted to a token (5.2.1).
  • An identifier, comment, string literal, character constant, or header name contains an invalid multibyte character or does not
@laoshaw
laoshaw / sve2.md
Created August 31, 2022 15:30 — forked from zingaburga/sve2.md
ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

ARM’s Scalable Vector Extensions: A Critical Look at SVE2 For Integer Workloads

Scalable Vector Extensions (SVE) is ARM’s latest SIMD extension to their instruction set, which was announced back in 2016. A follow-up SVE2 extension was announced in 2019, designed to incorporate all functionality from ARM’s current primary SIMD extension, NEON (aka ASIMD).

Despite being announced 5 years ago, there is currently no generally available CPU which supports any form of SVE (which excludes the [Fugaku supercomputer](https://www.fujitsu.com/global/about/innovation/