Skip to content

Instantly share code, notes, and snippets.

View chrizchow's full-sized avatar

Chriz Chow chrizchow

View GitHub Profile
@chrizchow
chrizchow / main.cpp
Created January 13, 2022 11:02
Perfect Forwarding Example
#include <iostream>
void subFunction(int&& i) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
void subFunction(int& i) {
std::cout << __PRETTY_FUNCTION__ << std::endl;
}
@chrizchow
chrizchow / main.cpp
Created January 5, 2022 03:26
std::move example
#include <iostream>
#include <cstring>
#include <vector>
class Cat {
private:
char * _data;
const int _length = 1024;
public:
@chrizchow
chrizchow / remotegdb
Last active December 29, 2021 09:17
Shell Script for SSHFS Mount + GDBServer 12345
#!/bin/bash
LOCAL_BUILD_PC="`whoami`@`hostname`"
[ -z "$REMOTE_TESTBED" ] && REMOTE_TESTBED="root@diag-memory-nv21"
REMOTE_MOUNT_POINT="~/`whoami`/testenv"
mount_remote() {
MOUNT_POINT="$1"
if [ -z "$MOUNT_POINT" ]; then echo "missing param" exit 1; fi
echo "Mounting $MOUNT_POINT to $REMOTE_MOUNT_POINT..."
@chrizchow
chrizchow / Makefile
Last active March 28, 2023 11:15
Using libnl to get wiphy and nl80211 cipher suite
CC = gcc
CFLAGS = -I/usr/include/libnl3
CFLAGS += -Wall -g
LDFLAGS = -L/usr/lib
LDLIBS = -lcrypto -lnl-3 -lnl-genl-3
TARGETS = wiphy
@chrizchow
chrizchow / Makefile
Last active December 23, 2023 13:24
Linux Minimal ioctl Network Device Example
KDIR := /home/chriz/repositories/WSL2-Linux-Kernel/
obj-m += chriz_ioctl_kernel.o
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
gcc -o chriz_ioctl_user chriz_ioctl_user.c
clean:
rm -rf *.o *.ko *.mod.* *.cmd .module* modules* Module* .*.cmd .tmp*
@chrizchow
chrizchow / Makefile
Last active April 19, 2021 09:23
Linux Minimal Netlink Example
KDIR := /home/chriz/repositories/WSL2-Linux-Kernel/
obj-m += chriz_netlink_kernel.o
all:
$(MAKE) -C $(KDIR) M=$(PWD) modules
gcc -o chriz_netlink_user chriz_netlink_user.c
clean:
rm -rf *.o *.ko *.mod.* *.cmd .module* modules* Module* .*.cmd .tmp*