Skip to content

Instantly share code, notes, and snippets.

@jimklimov
jimklimov / gist:e6775212f6c9781173e94f5085f32fdb
Last active May 29, 2023 21:26
Cross-building exfat tools for Android on a PC
View gist:e6775212f6c9781173e94f5085f32fdb

CONTEXT

TL;DR: See about installing MUSL tool-chain, and scroll down to exfatprogs build - that's what did work best for me.

Needed fsck.exfat 1.3.0 or newer to actively fix SD card issues on an Android phone. All builds I could find were older, so can only detect problems but not fix them even though these versions are supposed to be able to fix "some corruptions" (assuming exfat-fuse 1.3.0 here), e.g.:

:; which fsck.exfat
/system/bin/fsck.exfat
@jimklimov
jimklimov / backup-github.sh
Created May 11, 2023 19:08 — forked from rodw/backup-github.sh
A simple script to backup an organization's GitHub repositories, wikis and issues.
View backup-github.sh
#!/bin/bash
# A simple script to backup an organization's GitHub repositories.
#-------------------------------------------------------------------------------
# NOTES:
#-------------------------------------------------------------------------------
# * Under the heading "CONFIG" below you'll find a number of configuration
# parameters that must be personalized for your GitHub account and org.
# Replace the `<CHANGE-ME>` strings with the value described in the comments
# (or overwrite those values at run-time by providing environment variables).
View how-gpg.md

How to GPG as a Scala OSS Maintainer

tl;dr Generate a GPG key pair (exercising appropriate paranoia). Send it to key servers. Create a Keybase account with the public part of that key. Use your keypair to sign git tags and SBT artifacts.

GPG is probably one of the least understood day-to-day pieces of software in the modern developer's toolshed. It's certainly the least understood of the important pieces of software (literally no one cares that you can't remember grep's regex variant), and this is a testament to the mightily terrible user interface it exposes to its otherwise extremely simple functionality. It's almost like cryptographers think that part of the security comes from the fact that bad guys can't figure it out any more than the good guys can.

Anyway, GPG is important for open source in particular because of one specific feature of public/private key cryptography: signing. Any published software should be signed by the developer (or company) who published it. Ideally, consu

@jimklimov
jimklimov / .gitconfig
Created April 1, 2023 12:23
WSL2 wrapper for `git difftool`
View .gitconfig
# Add these lines to your ~/.gitconfig, to use wsl_wrapper
# program and your helper script to call winmerge GUI:
[mergetool "winmerge"]
cmd = \"$HOME/bin/winmerge.sh\" -u -maximize -wl -wr -fm -dl 'Mine: '\"$LOCAL\" -dm 'Merged: '\"$BASE\" -dr 'Theirs: '\"$REMOTE\" \"$LOCAL\" \"$BASE\" \"$REMOTE\" -o \"$MERGED\" -am
trustExitCode = true
[difftool "winmerge"]
cmd = \"$HOME/bin/winmerge.sh\" \"$LOCAL\" \"$REMOTE\"
[diff]
tool = winmerge
[merge]
View mpciEnumPatchapplStrategies.groovy
enum mpciEnumPatchapplStrategies {
MERGE("merge", "mrg"),
ADDDIFF("addDiff"),
BOGUS();
final static def addDiff = ADDDIFF, merge = MERGE, adddiff = ADDDIFF;
static {
def oldAsType = String.metaClass.getMetaMethod("asType", [Class] as Class[])
String.metaClass.asType = { Class type ->
@jimklimov
jimklimov / swap-noauto
Last active November 2, 2022 08:56
/etc/init.d/swap-noauto for Linux
View swap-noauto
#!/bin/sh
### /etc/init.d/swap-noauto for Linux
### Copyright (C) 2020-2022 by Jim Klimov
### Partially based on https://unix.stackexchange.com/a/594006
### and https://wiki.archlinux.org/index.php/ZFS#Swap_volume
### BEGIN INIT INFO
# Provides: swap
# Required-Start: $local_fs
@jimklimov
jimklimov / Jenkins-credump
Last active February 6, 2023 10:07
Jenkins script to dump credential contents
View Jenkins-credump
// Inspired by https://www.codurance.com/publications/2019/05/30/accessing-and-dumping-jenkins-credentials
// and https://stackoverflow.com/questions/35205665/jenkins-credentials-store-access-via-groovy
// and sources for found relevant credential classes (see their individual getters)
// Copyright (C) 2022-2023 by Jim Klimov, MIT License
import com.cloudbees.plugins.credentials.common.StandardCertificateCredentials;
def creds = com.cloudbees.plugins.credentials.CredentialsProvider.lookupCredentials(
//com.cloudbees.plugins.credentials.common.StandardUsernameCredentials.class,
@jimklimov
jimklimov / JimKlimov-opensource.txt
Last active October 17, 2022 13:45
Jim Klimov on the Open Source way
View JimKlimov-opensource.txt
Originally posted at https://github.com/jenkins-infra/jenkins.io/pull/5537#issuecomment-1272498645
Cheers @jmMeessen - I suppose we've met on some of the FOSDEMs so you might have some answers already, but I understand this is a neat questionnaire anyway :) Feel free to arrange and share:
> This is why I am reaching out to you to better get to know you as a community member and a contributor. Would you mind to answer the following questions?
Sure, but in a bit of a different order for a better narrative :)
> * Who are you? Where are you located? What do you do for a living?
@jimklimov
jimklimov / S99dns
Created September 12, 2022 08:55
Fix for WSL2 lacks internet DNS
View S99dns
#!/bin/sh
# Add as /etc/rc3.d/S99dns
if grep -q -E '^nameserver 8.8.8.8' /etc/resolv.conf ; then exit 0 ; fi
if [ "$1" = start ]; then
mkdir -p /run/resolvconf/ && echo 'nameserver 8.8.8.8' >> /etc/resolv.conf
fi
View gist:5af9918d39155ee6724faf17d71a2d94
fetch = +refs/pull/1027/head:refs/remotes/origin/PR-1027