Skip to content

Instantly share code, notes, and snippets.

View Pusnow's full-sized avatar

Wonsup Yoon Pusnow

View GitHub Profile
@kevinlee12
kevinlee12 / Device Toggle.bat
Created January 28, 2016 19:41
Toggle Enable/Disable Device Windows
@setlocal enableextensions enabledelayedexpansion
@echo off
rem ===========================================================================
rem The following toggles the touch screen on the Lenovo Thinkpad Yoga 12 using
rem DevCon.exe. Please ensure that you have Devcon.exe installed before running
rem this script. Please see Windows Device Console (Devcon.exe) page for Devcon
rem installation instructions.
rem This script must be run with admin privileges.
rem

Linux Hugepages

Hugepages are a hardware feature designed to reduce pressure on the translation lookaside buffer (TLB) for applications that operate on large contiguous memory regions.

Take a program that operates on a large 2MB internal structure as an example. If the program accesses that space in such a way that one byte in each regular 4k page is accessed, 2M/4k = 512 TLB entries are needed. Each TLB miss at the hardware level requires and interrupt and kernel intervention to resolve. However, if the allocation is backed by a 2M hugepage by mmap()ing with MAP_HUGETLB, only 1 TLB entry is required.

On x86_64, there are two hugepage sizes: 2MB and 1G. 1G hugepages are also called gigantic pages. 1G must be enabled on kernel boot line with hugepagesz=1G. Hugeages, especially 1G ones, should to be allocated early before memory fragments (i.e. at/near boot time) to increase the likelihood that they can be allocated successfully with minimal memory migration (i.e. defreg) required

@mcastelino
mcastelino / qemu_vhost.md
Last active February 23, 2024 08:59
QEMU Tips and Tricks

How to launch QEMU from command line without libvirt with macvtap and vhost support

This sets up a host local bridge with a macvlan interface for VM to host communication. The macvtap is setup with vhost support.

The command line options to note are

-netdev tap,fd=3,id=hostnet0,vhost=on,vhostfd=4 3<>$"$tapdev" 4<>/dev/vhost-net -device virtio-net-pci,netdev=hostnet0,id=net0,mac=$(< /sys/class/net/testtap/address)

This sets up two different fd's. The first for macvtap and the second for vhost-net.

@mbinna
mbinna / effective_modern_cmake.md
Last active April 18, 2024 19:26
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft

@raplin
raplin / gist:f059ec9415b556c5cc51e7c5e4caf7f6
Created October 13, 2020 22:36
BCM43465 PCIe card iw list (4x4 ac 160Mhz, dual band)
# This card is pretty dope; gets hot at high MIMO tx power, needs cooling! Unclear if these listed TX powers are correct at the antenna port..
iw list
Wiphy phy1
max # scan SSIDs: 10
max scan IEs length: 2048 bytes
max # sched scan SSIDs: 0
max # match sets: 0
max # scan plans: 1
max scan plan interval: -1