Skip to content

Instantly share code, notes, and snippets.

@roryrjb
roryrjb / ff
Created July 22, 2023 15:39
A simple file finder/grepper that supports ignore patterns (add one per line in ~/.ffignore)
#!/usr/bin/env python3
import argparse
import fnmatch
import os
import sys
def walktree(root, ignored_patterns):
try:
@roryrjb
roryrjb / npm.c
Last active January 22, 2023 11:05
npm.exe: a bad hack for when your Node.js project that spawns npm isn't quite portable
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#pragma comment(lib, "Shlwapi.lib")
/* Find the end of argv[0]. */
static WCHAR *
findargs(WCHAR *s)
{
if (s[0] == 34)
@roryrjb
roryrjb / .gitattributes
Created January 22, 2023 10:52
WSL1 git attributes
* text=auto eol=lf
*.{cmd,[cC][mM][dD]} text eol=crlf
*.{bat,[bB][aA][tT]} text eol=crlf
@roryrjb
roryrjb / subl
Last active January 22, 2023 16:20
Sublime Text wrapper for use within WSL1
#!/usr/bin/env python3
import sys
import subprocess
import os
filename = os.path.abspath(sys.argv[1])
if filename.startswith('/mnt'):
# /mnt/c/a/b/c.txt -> c:\a\b\c.txt