Skip to content

Instantly share code, notes, and snippets.

View chrismwendt's full-sized avatar

Chris Wendt chrismwendt

View GitHub Profile
@chrismwendt
chrismwendt / DXError.log
Last active February 9, 2024 19:26
Battlefield 2 installation error, Apple Game Porting Toolkit, mac
--------------------
[06/08/23 07:15:49] module: dxupdate(Mar 30 2011), file: dxupdate.cpp, line: 6124, function: CFusion::CFusion
Failed API: LoadLibraryShim()
Error: (0x80070006) - Invalid handle.^M
--------------------
[06/08/23 07:15:49] module: dxupdate(Mar 30 2011), file: dxupdate.cpp, line: 2969, function: IsMDXInUse
@chrismwendt
chrismwendt / git-log-histogram.sh
Created October 7, 2022 17:25
Prints the number of commits on <branch> in each of the last <buckets> seconds/minutes/hours/days.
#!/usr/bin/env bash
branch="$1"
buckets="$2"
if [ -z "$buckets" ]; then
echo "Usage: git-log-histogram <branch> <buckets>"
echo
echo "Prints the number of commits on <branch> in each of the last <buckets> seconds/minutes/hours/days."
echo
@chrismwendt
chrismwendt / conflicts.py
Created February 2, 2022 00:28
Pretty prints git conflicts
#!/usr/bin/env python3
import subprocess
import tempfile
from colored import stylize, fg, attr
import os
import sys
def main():
@chrismwendt
chrismwendt / lsif-rdf-oxigraph.py
Last active October 11, 2021 21:08
Script for running SPARQL queries against LSIF dumps for debugging (rdflib and oxigraph)
#!/usr/bin/env python3
from pygments import highlight
from pygments.lexers import PythonLexer
from pygments.formatters import Terminal256Formatter
from pprint import pformat
import os
import json
from prettytable import PrettyTable
from colored import stylize, fg
@chrismwendt
chrismwendt / clear-dirty-flag.py
Last active September 18, 2021 08:18
Clear dirty flag in each migration
#!/usr/bin/env python3
import os
from colored import fg, bg, stylize, attr
def wrap_in_transaction(path, content):
lines = content.splitlines()
if 'COMMIT;' in lines:
@chrismwendt
chrismwendt / lsp-to-sourcegraph-extension-api.ts
Created November 7, 2018 21:52
Coverrts from LSP types to Sourcegraph extension API types
import * as lsp from 'vscode-languageserver-protocol'
import * as sourcegraph from 'sourcegraph'
import { Location, Position, Range } from 'sourcegraph'
const lspToSEA = {
location: ({
currentDocURI,
location: { range, uri: uriFromLangServer },
}: {
currentDocURI: string
@chrismwendt
chrismwendt / diffme
Created October 18, 2018 05:24
Shows differences between base-to-a and base-to-b in git merge conflicts
#!/usr/bin/env stack
{-
stack
--resolver lts-10.4
--install-ghc
script
--package megaparsec
--package rainbow
--package typed-process
--package bytestring
package main
import (
"flag"
"fmt"
"log"
"net/http"
"os"
"os/exec"
"os/signal"
@chrismwendt
chrismwendt / 3gods.hs
Created March 4, 2018 22:27
A solution to the 3 gods puzzle
#!/usr/bin/env stack
{-
stack
--resolver lts-10.1
--install-ghc
--package random-extras
--package random-fu
script
-}
@chrismwendt
chrismwendt / 3waydiff.hs
Created February 4, 2018 09:24
Shows changes from both sides in a file with 3-way merge conflicts
#!/usr/bin/env stack
{-
stack
--resolver lts-10.4
--install-ghc
script
--package temporary
--package megaparsec
--package rainbow
--package typed-process