Skip to content

Instantly share code, notes, and snippets.

View LoganDark's full-sized avatar

LoganDark LoganDark

View GitHub Profile
@LoganDark
LoganDark / upgrade.md
Created May 31, 2022 11:18
Perform an in-place upgrade

Why not reinstall?

You may have seen that the premier advice online whenever literally anything goes wrong is to reinstall Windows. No, don't reset or refresh - wipe your hard drive and reinstall the entire OS. Windows can't be trusted to unbreak invariants.

What are invariants?

For non-technical users, "invariants" are rules that must apply in order for an operating system to work correctly. This includes things like file & folder permissions being correct. These invariants are sometimes broken which result in one or more parts of your working system becoming nonworking.

Windows is famously bad at repairing broken invariants, which is why the advice is typically that you need to reinstall the entire thing - to get a fresh new system with all the invariants upheld.

@LoganDark
LoganDark / backup.md
Created May 31, 2022 11:15
Back up your computer

Preface

There are many ways to back up your computer. In order from least effective to most effective, we have:

  • Copy all the files manually to another disk periodically. (Optionally, use an automated tool for this, like rsync.)

    This sucks. Most of the time you don't even preserve permissions. Plus it's horribly error-prone. And you also can't restore a working system from it.

  • Image your entire boot drive.

@LoganDark
LoganDark / README.md
Last active February 2, 2024 21:32
I can't profile on my Windows PC

Update #2

I was able to rebuild perf in order to make it work. My previous version of perf was built with these features:

...                         dwarf: [ OFF ]
...            dwarf_getlocations: [ OFF ]
...                         glibc: [ on  ]
...                        libbfd: [ OFF ]
...                libbfd-buildid: [ OFF ]
@LoganDark
LoganDark / nanorc.nanorc
Last active December 20, 2021 03:37
Very colorful and advanced nanorc syntax file
# Created by LoganDark for Nano 6.0
syntax "nanorc" "(\.?|^|/)nanorc$"
comment "#"
#icolor red,white "^\s*i?color.*$"
icolor red "^\s*\S+.*$"
# set directive
import {DependencyList, useCallback, useDebugValue, useRef} from 'react'
import useForceUpdate from 'use-force-update'
/*! Copyright © 2021 LoganDark
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
@LoganDark
LoganDark / atom-watcher.d.ts
Created September 27, 2021 08:37
Typings for @atom/watcher
declare module '@atom/watcher' {
import {Disposable} from 'event-kit'
export const DISABLE: unique symbol
export const STDOUT: unique symbol
export const STDERR: unique symbol
// May be one of:
//
// - A `string` specifying a path to log to a file. Be careful that you
@LoganDark
LoganDark / LanguageHack.kt
Last active May 9, 2020 10:59
Allows the Minecraft dedicated server to see localized (TranslatableText) messages. Activate in your ModInitializer only on the server side
package net.logandark.languagehack
import com.google.gson.Gson
import com.google.gson.JsonObject
import net.fabricmc.loader.api.FabricLoader
import net.logandark.languagehack.mixin.MixinLanguage
import net.minecraft.util.JsonHelper
import net.minecraft.util.Language
import org.apache.logging.log4j.core.util.Closer
import java.io.InputStreamReader

Keybase proof

I hereby claim:

  • I am logandark on github.
  • I am logandark (https://keybase.io/logandark) on keybase.
  • I have a public key ASDjdjq5DH55DsrKKK-0hZThtdZwrAzIfbqCJIXoFBmCjgo

To claim this, I am signing this object:

@LoganDark
LoganDark / kexts.sh
Last active September 13, 2018 16:21
#!/bin/bash
# Print a list of third-party kexts your system includes. Output is made for Markdown.
kextstat | grep -v com.apple | egrep -o '\S+ \S+ \S+ <(\d+\s+)*\d>$' | egrep -o '^\S+' | tr '\n' ',' | sed 's/,/`, `/g' | sed 's/`, `$//g' | sed 's/^/`/' | sed 's/$/`/'
@LoganDark
LoganDark / crash-percent.js
Last active December 23, 2019 10:18
A notifier that warns you when macOS is about to crash.
// This is JXA, i.e. you can't run it with plain `node`. Use `osascript` or the Script Editor.
// I recommend exporting it to an `.app` and running it at login if you have my same issue.
// Requires this script: https://gist.github.com/LoganDark/b8c74e14c06b77e6f16d4492c5bda928
// CONFIGURE crashPercentScript in run() to point to your script. Make sure to chmod +x to make
// it executable.
function getCrashPercent(app, script) {
return +/\d+/.exec(app.doShellScript(script).split('\r')[0])[0]
}