Skip to content

Instantly share code, notes, and snippets.

@mike-myers-tob
mike-myers-tob / Working GDB on macOS 11.md
Last active January 15, 2024 17:15
Steps to get GDB actually working in April 2021 on macOS (Intel x86-64 only)

Debug with GDB on macOS 11

The big reason to do this is that LLDB has no ability to "follow-fork-mode child", in other words, a multi-process target that doesn't have a single-process mode (or, a bug that only manifests when in multi-process mode) is going to be difficult or impossible to debug, especially if you have to run the target over and over in order to make the bug manifest. If you have a repeatable bug, no big deal, break on the fork from the parent process and attach to the child in a second lldb instance. Otherwise, read on.

Install GDB

Don't make the mistake of thinking you can just brew install gdb. Currently this is version 10.2 and it's mostly broken, with at least two annoying bugs as of April 29th 2021, but the big one is https://sourceware.org/bugzilla/show_bug.cgi?id=24069

$ xcode-select install  # install the XCode command-line tools
@edoan
edoan / Drive rename.js
Created February 20, 2020 04:03
Remove "Copy of" filename prefix when copying an entire folder from one Google Drive account to another Google Drive account
/* Need to copy an entire folder from one Google Drive account to another Google Drive account?
* 1. Right-click on original folder in Google Drive
* 2. Share with the destination Google account
* 3. Go into destination account's Google Drive
* 4. Find the shared folder under "Shared with me"
* 5. Select all the files (Ctrl-A / Cmd-A)
* 6. Right-click, Make a copy
* 7. Create a New Folder in destination account's Google Drive
* 8. Go to Recent
* 9. Select all recently copied files and move to the new folder
@TechnologistAU
TechnologistAU / mfi.sh
Last active January 12, 2023 09:57
mFi Installation Script for Raspberry Pi
#!/bin/bash
################################################################################
#
# This script automates the installation of the mFi controller software on the
# Raspberry Pi.
#
# http://www.technologist.site/ubnt
#
################################################################################
@alfredkrohmer
alfredkrohmer / xbox-one-wireless-protocol.md
Created November 23, 2016 21:52
XBox One Wireless Controller Protocol

Physical layer

The dongle itself is sending out data using 802.11a (5 GHz WiFi) with OFDM and 6 Mbit/s data rate:

Radiotap Header v0, Length 38
    Header revision: 0
    Header pad: 0
    Header length: 38
    Present flags
@wojteklu
wojteklu / clean_code.md
Last active May 7, 2024 15:24
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@gsomoza
gsomoza / ztvpn.sh
Last active September 28, 2020 04:17
ZeroTier VPN Switch Script
#!/bin/bash
ZT_NETWORK="NETWORK_ID"
# colors
RCol='\033[0m' # Text Reset
LGra='\033[0;37m';
Red='\033[0;31m';
Gre='\033[0;32m';
Yel='\033[0;33m';
@joerick
joerick / termfix.c
Last active February 16, 2022 12:49
C program which will fix the terminal when an SDL app has crashed or been SIGKILL'd before cleaning up after itself
#include <sys/ioctl.h>
#include <errno.h>
#include <string.h>
#include <stdio.h>
#include <linux/vt.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <linux/kd.h>
#include <linux/keyboard.h>
@rdb
rdb / js_linux.py
Last active April 8, 2024 10:12
Access joysticks/game controllers from Python in Linux via the joystick driver. See https://discourse.panda3d.org/t/game-controllers-on-linux-without-pygame/14128
# Released by rdb under the Unlicense (unlicense.org)
# Based on information from:
# https://www.kernel.org/doc/Documentation/input/joystick-api.txt
import os, struct, array
from fcntl import ioctl
# Iterate over the joystick devices.
print('Available devices:')