Skip to content

Instantly share code, notes, and snippets.

View GitaiQAQ's full-sized avatar
🏠
Working for home

Gitai GitaiQAQ

🏠
Working for home
View GitHub Profile
@seachai
seachai / gist:948ed1eeafa32ce03db6685edb879f71
Last active May 2, 2024 10:19
iTerm 2 Natural Text Editing Preset
On iTerm2 - Open Preferences > Profiles > Keys > Key Mappings > Presets > Select Natural Text Editing
- You can move a word backwards using Option ⌥ + ← and a word forwards using Option ⌥ + →
- Move to the start of the line using fn + ← and to the end of the line with fn + →.
- Also you can delete a word backwards using Option ⌥ + ⌫, delete the whole line using Command ⌘ + ⌫.
If the preset doesn't appear, reinstall iTerm2. If you installed it using Homebrew + Cask:
brew cask reinstall iterm2
@ccbrown
ccbrown / DumpHex.c
Last active March 27, 2024 17:32
Compact C Hex Dump Function w/ASCII
#include <stdio.h>
void DumpHex(const void* data, size_t size) {
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i) {
printf("%02X ", ((unsigned char*)data)[i]);
if (((unsigned char*)data)[i] >= ' ' && ((unsigned char*)data)[i] <= '~') {
ascii[i % 16] = ((unsigned char*)data)[i];