Skip to content

Instantly share code, notes, and snippets.

View xkr47's full-sized avatar

Jonas Berlin xkr47

View GitHub Profile
@xkr47
xkr47 / cvsignore2git.sh
Last active December 8, 2023 09:58
cvsignore -> gitignore converter
#!/bin/sh
if [ ! -d .git ]; then
echo ERROR: Please run this in the root of the git repository
exit 1
fi
cat > .gitignore <<'EOF'
# CVS global ignores
RCS
@xkr47
xkr47 / btrfs-info.sh
Created December 5, 2023 10:47
Dump all kinds of info for btrfs mounts
#!/bin/bash
[ "$#" = 1 ]
r () {
echo -ne "\033[1m------ "
echo -n "$@"
echo -e "\033[m"
"$@"
}
@xkr47
xkr47 / log4j.properties
Created August 29, 2013 19:02
log4j configuration with different colors for different log levels - also works with Eclipse Ansi Console: http://mihai-nita.net/2013/06/03/eclipse-plugin-ansi-in-console/
log4j.debug=false
# Default level is INFO
log4j.rootLogger=INFO,StdoutErrorFatal,StdoutWarn,StdoutInfo,StdoutDebug,StdoutTrace
# and for com.some.package.* log everything
log4j.logger.com.some.package=TRACE
log4j.appender.StdoutErrorFatal=org.apache.log4j.ConsoleAppender
log4j.appender.StdoutErrorFatal.layout=org.apache.log4j.PatternLayout
@xkr47
xkr47 / libera.irssi
Last active September 28, 2023 09:39
How to add the libera.chat network to irssi
Replace all <....> parts with your specific details
/network add -nick <nick> libera
/server add -network libera -auto -ssl irc.libera.chat 6697
/connect libera
/query NickServ
register <password> <email>
<copypaste line from email>
/network add -autosendcmd "" -sasl_username <user> -sasl_password <pass> -sasl_mechanism PLAIN libera
/channel add -auto <channel> libera
@xkr47
xkr47 / letsencrypt-jetty.sh
Last active August 29, 2023 07:22
How to use Letsencrypt certificate & private key with Jetty
# input: fullchain.pem and privkey.pem as generated by the "letsencrypt-auto" script when run with
# the "auth" aka "certonly" subcommand
# convert certificate chain + private key to the PKCS#12 file format
openssl pkcs12 -export -out keystore.pkcs12 -in fullchain.pem -inkey privkey.pem
# convert PKCS#12 file into Java keystore format
keytool -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks
# don't need the PKCS#12 file anymore
@xkr47
xkr47 / README.md
Last active June 16, 2023 07:11
Script for moving/renaming files/directories arbitrarily in whole git history of single branch, using perl expressions

Install into PATH e.g. $HOME/bin/ as "git-filter-mv" and chmod a+rx git-filter-mv

It works with any special characters in filenames like tabs and linefeeds. It works with empty commits.

Based on example from git-filter-branch manpage.

If you want to print debug messages, use STDERR e.g. print STDERR "File: $_\n";

Examples:

@xkr47
xkr47 / fmt_write.rs
Last active December 14, 2022 13:27
UTF-8 -emitting fmt::Write wrapper for io::Write
struct FmtWriter<W: std::io::Write>(W);
impl <W: std::io::Write> std::fmt::Write for FmtWriter<W> {
fn write_str(&mut self, s: &str) -> fmt::Result {
self.0.write_all(s.as_bytes()).map_err(|_| fmt::Error)
}
}
@xkr47
xkr47 / README.md
Last active November 28, 2021 10:10
VDR 2.4.0 channels.conf for DVB-C channels of Karis Telefon / Karjaan puhelin 2021-11-26

VDR 2.4.0 channels.conf for DVB-C channels of Karis Telefon / Karjaan puhelin 2021-11-26

Produced using w_scan -fc -c FI -Q1 -S1 -o21 using w-scan version 20170107-2

@xkr47
xkr47 / git-fetch-sha
Last active July 26, 2021 08:41
Fetch commit by SHA from remote even if not attached to a branch — useful for e.g. force-pushed PRs whose earlier commits are no longer directly available
#!/bin/bash
# by Jonas Berlin 2021 from https://gist.github.com/xkr47/a82d710092847a39901a563b22e82b4b
# 1. Place in e.g. $HOME/bin/git-fetch-sha
# 2. Run "git fetch-sha" for usage
set -e
remote="$1"
sha="$2"
@xkr47
xkr47 / focusrite-scarlett-linux.md
Last active March 24, 2021 23:01
Focusrite Scarlett Linux support 2019-07-29

Focusrite Scarlett Linux support 2019-07-29

1st gen <2012

  • Solo ❓
  • Studio ❓
  • 2i2 ✅
  • 2i4 ✅
  • 6i6 1235:8012 ✅ since Linux 3.19