Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env perl
use strict;
use warnings;
use constant SZ => 4096;
use POSIX qw(_exit);
my @args = qw(cat-file --batch);
if (@ARGV && $ARGV[0] eq '-L') {
push @args, '--follow-symlinks';
shift;
JAVA_OPTS="$JAVA_OPTS -Dapple.awt.UIElement=true"
@ephemient
ephemient / nspawn-enter
Last active March 15, 2021 15:33
A substitute for "machinectl shell" when the systemd-machined inside the nspawn container is too old (e.g. CentOS 7)
#!/usr/bin/env python3
import argparse
import contextlib
import ctypes
import dbus
import errno
import fcntl
import io
import os
import pickle
#!/bin/sh -e
git reset "$(git hash-object -t commit -w --stdin <<END
tree $(git hash-object -t tree -- /dev/null)
author nobody <nobody@localhost> 0 +0000
committer nobody <nobody@localhost> 0 +0000
END
)"
git log -1
#!/bin/bash -ex
PROFILE=$(mktemp -d)
trap 'rm -rf "${PROFILE}"' 0
coproc ssh -Snone -D1080 ${GW:?} 'echo -n 1; cat'
read -r -n 1 -u ${COPROC[0]}
google-chrome-stable --proxy-server=socks5://localhost:1080 --host-resolver-rules='MAP * 0.0.0.0 , exclude localhost' --user-data-dir="${PROFILE}" --no-first-run "$@"
#define _GNU_SOURCE
#include <ctype.h>
#include <inttypes.h>
#include <setjmp.h>
#include <signal.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>
@ephemient
ephemient / Makefile
Last active June 9, 2016 22:18
mem.S
LDFLAGS += -Wl,--build-id=none -nostdlib -s
run: mem
strace -eraw=all ./mem >/dev/null
mem: mem.S
$(CC) $(ASFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH) $^ $(LOADLIBES) $(LDLIBS) -o $@
mem-translated: mem-translated.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $(TARGET_MACH) $^ $(LOADLIBES) $(LDLIBS) -o $@
.PHONY: run
07070100000001000081240000000000000000000000010000000000000000000000000000000000000000000000000000000900000000.Trashes07070100000002000081240000000000000000000000010000000000000000000000000000000000000000000000000000002400000000.com.apple.timemachine.donotpresent070701000000030000416d0000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000.fseventsd07070100000004000081240000000000000000000000010000000000000000000000000000000000000000000000000000001200000000.fseventsd/no_log07070100000005000081240000000000000000000000010000000000000000000000000000000000000000000000000000001600000000.metadata_never_index07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000b00000000TRAILER!!!
@ephemient
ephemient / ⁄etc⁄pacman.d⁄hooks⁄linux-modules-post.hook
Last active May 24, 2024 13:13
(Arch Linux) Keep current modules around during kernel upgrade
[Trigger]
Operation = Upgrade
Type = Package
Target = linux
[Action]
Description = Restore Linux kernel modules
When = PostTransaction
Depends = coreutils
Depends = rsync
#!/usr/bin/perl
# Ported from https://github.com/prashnts/dotfiles/blob/master/etc/dafaq.lol/dafaq.lol.go https://ascii.li/emoji
use strict;
use warnings;
use utf8;
use feature qw(say);
use Term::ANSIColor qw(LOCALCOLOR YELLOW GREEN);