Skip to content

Instantly share code, notes, and snippets.

Avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
View brightness_ctl_DDC.cpp
// Phys monitor control via DDC/CI or VESA commands
// (David Lowndes)
// From https://social.msdn.microsoft.com/Forums/en-US/5437ddb8-af86-4cf0-8061-798e6601e08e/how-to-control-system-brightness-using-windows-api-?forum=windowsgeneraldevelopmentissues#554b7b7f-0aab-429d-9c36-fd39608979b0
#include <Windows.h>
#include <physicalmonitorenumerationapi.h>
#include <highlevelmonitorconfigurationapi.h>
#pragma comment( lib, "Dxva2.lib" )
void
@mcxiaoke
mcxiaoke / crc16.c
Created Jun 12, 2021 — forked from tijnkooijmans/crc16.c
CRC-16/CCITT-FALSE
View crc16.c
uint16_t crc16(char* pData, int length)
{
uint8_t i;
uint16_t wCrc = 0xffff;
while (length--) {
wCrc ^= *(unsigned char *)pData++ << 8;
for (i=0; i < 8; i++)
wCrc = wCrc & 0x8000 ? (wCrc << 1) ^ 0x1021 : wCrc << 1;
}
return wCrc & 0xffff;
@mcxiaoke
mcxiaoke / msys2.reg
Created Jun 8, 2021 — forked from magthe/msys2.reg
MSYS2 "Open Here" registry settings
View msys2.reg
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2]
@="Open MSYS2 here"
[HKEY_CLASSES_ROOT\Directory\Background\shell\open_msys2\command]
@="c:\\msys64\\usr\\bin\\mintty.exe /bin/sh -lc 'cd \"$(cygpath \"%V\")\"; exec bash'"
[HKEY_CLASSES_ROOT\Folder\shell\open_msys2]
@="Open MSYS2 here"
View openwrt-in-docker.md

OpenWrt Docker镜像构建

为了在Docker中运行OpenWrt系统,我们需要用到OpenWrt的docker镜像,网上有很多人分享已经制作好的镜像。但是,每个人都有自己不同的需求,自己学会制作镜像就显得特别重要了。

其实使用OpenWrt的固件, 可以很方便的构建Docker镜像,这里的固件不光是官方固件,也可以是经过自己定制编译生成的固件。

直接使用

@mcxiaoke
mcxiaoke / windows-terminal-config.json
Last active Jun 8, 2021
Windows Terminal Profiles Settings
View windows-terminal-config.json
{
"$schema": "https://aka.ms/terminal-profiles-schema",
// Add custom actions and keybindings to this array.
// To unbind a key combination from your defaults.json, set the command to "unbound".
// To learn more about actions and keybindings, visit https://aka.ms/terminal-keybindings
"actions":
[
// Copy and paste are bound to Ctrl+Shift+C and Ctrl+Shift+V in your defaults.json.
// These two lines additionally bind them to Ctrl+C and Ctrl+V.
// To learn more about selection, visit https://aka.ms/terminal-selection
@mcxiaoke
mcxiaoke / profile.ps1
Created Jun 3, 2021 — forked from timsneath/profile.ps1
PowerShell template profile: adds some useful aliases and functions
View profile.ps1
### PowerShell template profile
### Version 1.03 - Tim Sneath <tim@sneath.org>
### From https://gist.github.com/timsneath/19867b12eee7fd5af2ba
###
### This file should be stored in $PROFILE.CurrentUserAllHosts
### If $PROFILE.CurrentUserAllHosts doesn't exist, you can make one with the following:
### PS> New-Item $PROFILE.CurrentUserAllHosts -ItemType File -Force
### This will create the file and the containing subdirectory if it doesn't already
###
### As a reminder, to enable unsigned script execution of local scripts on client Windows,
@mcxiaoke
mcxiaoke / windows-tips.md
Last active Jun 15, 2021
Windows 10 Tips
View windows-tips.md

Windows Tips

Repair System Errors

DISM.exe /Online /Cleanup-image /Restorehealth
sfc /scannow
@mcxiaoke
mcxiaoke / 7z-benchmarks.txt
Created May 14, 2021
7z benchmak on three devices
View 7z-benchmarks.txt
x64 MacBook Pro 2013 i3-4285u
CPU Freq: 2624 2781 2885 2891 2882 2872 2877 2867 2864
RAM size: 8192 MB, # CPU hardware threads: 4
RAM usage: 882 MB, # Benchmark threads: 4
Compressing | Decompressing
Dict Speed Usage R/U Rating | Speed Usage R/U Rating
KiB/s % MIPS MIPS | KiB/s % MIPS MIPS
@mcxiaoke
mcxiaoke / README.md
Created Mar 6, 2021 — forked from tombigel/README.md
How to Change Open Files Limit on OS X and macOS Sierra (10.8 - 10.12)
View README.md

How to Change Open Files Limit on OS X and macOS

This text is the section about OS X Yosemite (which also works for macOS Sierra) from https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/#mac-os-x

The last time i visited this link it was dead (403), so I cloned it here from the latest snapshot in Archive.org's Wayback Machine https://web.archive.org/web/20170523131633/https://docs.basho.com/riak/kv/2.1.4/using/performance/open-files-limit/

Mac OS X

To check the current limits on your Mac OS X system, run: