Skip to content

Instantly share code, notes, and snippets.

View andrebrait's full-sized avatar

Andre Brait andrebrait

View GitHub Profile
@andrebrait
andrebrait / keychron_linux.md
Last active April 15, 2024 18:59
Keychron keyboards on Linux + Bluetooth fixes

Here is the best setup (I think so :D) for K-series Keychron keyboards on Linux.

Note: many newer Keychron keyboards use QMK as firmware and most tips here do not apply to them. Maybe the ones related to Bluetooth can be useful, but everything related to Apple's keyboard module (hid_apple) on Linux, won't work. As far as I know, all QMK-based boards use the hid_generic module instead. Examples of QMK-based boards are: Q, Q-Pro, V, K-Pro, etc.

Most of these commands have been tested on Ubuntu 20.04 and should also work on most Debian-based distributions. If a command happens not to work for you, take a look in the comment section.

Make Fn + F-keys work (NOT FOR QMK-BASED BOARDS)

Older Keychron keyboards (those not based on QMK) use the hid_apple driver on Linux, even in the Windows/Android mode, both in Bluetooth and Wired modes.

1G1R Commands for 1G1R ROM Set Generator

Create 1G1R ROM Sets from No-Intro P/C XML DAT files.

Additional ROMs are excluded if they meet any of the following criteria:

  • Non-Game (Program, Tester, Greeting Card, Music Album, etc...)
  • Bundle (2+ games in one ROM where a single version already exists)

Note: This list is currently a work-in-progress.

Index

mvn archetype:generate \
-DinteractiveMode=false \
-DarchetypeGroupId=org.openjdk.jmh \
-DarchetypeArtifactId=jmh-java-benchmark-archetype \
-DgroupId=com.avenuecode.snippet \
-DartifactId=first-benchmark \
-Dversion=1.0 \
@andrebrait
andrebrait / kodi.service
Created May 10, 2021 07:41
Start KODI on graphical interface startup/desktop login, useful for Raspberry Pi users
# This is useful for those who want to have KODI running on startup, but still want to use a full desktop (e.g. Raspbian).
# This will make KODI run as soon as the graphical interface (be it X or Wayland) starts up and the user logs in
# It will only start KODI after the network and remote shares have been started up
[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target graphical.target
Wants = graphical.target
[Service]
User = pi

Keybase proof

I hereby claim:

  • I am andrebrait on github.
  • I am andrebrait (https://keybase.io/andrebrait) on keybase.
  • I have a public key ASBOK9lU4evQpiRR5-G9MvCsgzR_aklowmFSyP-aAm43-wo

To claim this, I am signing this object:

Running: distance
[ ~29975598 ops/ms ]
Running: constant
[ ~421092 ops/ms ]
Running: nothing
[ ~274938 ops/ms ]
static double distance(double x1, double y1, double x2, double y2) {
double dx = x2 - x1;
double dy = y2 - y1;
return Math.sqrt((dx * dx) + (dy * dy));
}
static double constant(double x1, double y1, double x2, double y2) {
return 0.0d;
}
@Benchmark
public void testMethod(MyState state, Blackhole blackhole) {
int sum1 = state.a + state.b;
int sum2 = state.a + state.a + state.b + state.b;
blackhole.consume(sum1);
blackhole.consume(sum2);
}
@State(Scope.Thread)
public static class MyState {
public int a = 1;
public int b = 2;
}
@Benchmark
public int testMethod(MyState state) {
int sum = state.a + state.b;
return sum;
@Benchmark
public int testMethod() {
int sum = 3;
return sum;
}