Skip to content

Instantly share code, notes, and snippets.

View alexmyczko's full-sized avatar
🏝️
What you don’t take to your island, you don’t have.

Alex Myczko alexmyczko

🏝️
What you don’t take to your island, you don’t have.
View GitHub Profile

Manually fixing bit flips in BTRFS

Somehow my BTRFS file system became corrupted by what appears to be a single bit flip in a metadata field. Rather than copying all the data and reformatting the file system, which would have required another disk at least as large as the original, I decided to try to fix this manually, which appears to have worked. I've documented the procedure I've used here, in case I need it again or someone else runs into a similar issue and finds it useful.

The first thing you should do is run btrfs check. For me this produced the following output:

Opening filesystem to check...
Checking filesystem on /dev/nvme0n1p1
UUID: ec7afe1c-8478-450a-82fc-d17b32d8ca3d
@metametapod
metametapod / README.md
Last active May 18, 2024 00:06
Script to automatically update hosts file from a filter list

Minimal script to quickly update hosts file from a filter list.

Note that this does not replace the entirety of the hosts file, so previous customizations will remain intact.

Installation

Download the update_hosts script below or run:

$ curl --proto "=https" --tlsv1.2 https://gist.githubusercontent.com/metametapod/4c4a7a9c888343fc6e722f8ed77aa763/raw/update_hosts -o update_hosts

How to make a small tweak to free software

The target audience for this is people who are beginners at software engineering and using linux. A lot of the information here may be obvious or already known to you. The language involved is C but you do not need to know any C to read this tutorial. I used mg to write this blog post. I used vs code to edit the source code.

This post is also available on gopher://tilde.team:70/0/~river/tweak-free-software

If you use a piece of free software and it's 99% perfect but there's just this one thing it does that annoys the hell out of you.. you can in theory just fix it! Here's a look at what doing that is like. Hopefully it inspires you, or you pick up a could tricks on the way!

Step 0: Have a problem

# IDA (disassembler) and Hex-Rays (decompiler) plugin for Apple AMX
#
# WIP research. (This was edited to add more info after someone posted it to
# Hacker News. Click "Revisions" to see full changes.)
#
# Copyright (c) 2020 dougallj
# Based on Python port of VMX intrinsics plugin:
# Copyright (c) 2019 w4kfu - Synacktiv
@fay59
fay59 / Quirks of C.md
Last active January 23, 2024 04:24
Quirks of C

Here's a list of mildly interesting things about the C language that I learned mostly by consuming Clang's ASTs. Although surprises are getting sparser, I might continue to update this document over time.

There are many more mildly interesting features of C++, but the language is literally known for being weird, whereas C is usually considered smaller and simpler, so this is (almost) only about C.

1. Combined type and variable/field declaration, inside a struct scope [https://godbolt.org/g/Rh94Go]

struct foo {
   struct bar {
 int x;
@steven2358
steven2358 / ffmpeg.md
Last active July 22, 2024 08:40
FFmpeg cheat sheet
@varqox
varqox / install_debian_with_debootstrap_howto.md
Last active July 14, 2024 19:13
Instructions how to install Debian using debootstrap
@willerce
willerce / jquery.touchwipe.js
Created January 2, 2015 18:46
jQuery Touchwipe Plugin
/**
* jQuery Plugin to obtain touch gestures from iPhone, iPod Touch and iPad, should also work with Android mobile phones (not tested yet!)
* Common usage: wipe images (left and right to show the previous or next image)
*
* @author Andreas Waltl, netCU Internetagentur (http://www.netcu.de)
* @version 1.1.1 (9th December 2010) - fix bug (older IE's had problems)
* @version 1.1 (1st September 2010) - support wipe up and wipe down
* @version 1.0 (15th July 2010)
*/
(function($) {
@xaviervia
xaviervia / gist:6087296
Last active January 22, 2024 13:23
Reading the output from a shell command in Objective-C
- (void) doIt {
// Define the command name and the arguments array (the nil at the end is needed)
NSArray *arguments = [NSArray arrayWithObjects:@"--some-argument", @"--another", nil];
NSString *command = @"do-something-shell";
// Setup the NSTask for the command execution
NSTask *task = [[NSTask alloc] init];
task.launchPath = command;
task.arguments = arguments;