Skip to content

Instantly share code, notes, and snippets.

View umjammer's full-sized avatar

Naohide Sano umjammer

View GitHub Profile

tmux on msys2 windows10

$ script -c "tmux -u" /dev/null
@umjammer
umjammer / convert_colorspace.md
Created September 14, 2021 18:05
[ImageMagick] convert colorspace to YCbCr420

convert colorspace to YCbCr420

$ convert in.jpg -colorspace YCbCr -sampling-factor 4:2:0 -strip out.jpg
@umjammer
umjammer / rearrange_page_number.md
Created August 15, 2021 07:21
Correct page numbers for scanned pdf command line

Correct page numbers for scanned pdf

$ pdftk A=target.pdf cat Aeven output even.pdf
$ pdftk A=target.pdf cat Aodd output odd.pdf
$ pdftk A=odd.pdf B=even.pdf shuffle A B output out.pdf
@umjammer
umjammer / remove_book_app_books_on_your_mac.md
Last active August 12, 2021 01:34
how to remove book.app epubs only on your mac (remove only downloaded data, let those remain on iCloud)

how to remove book.app epubs only on your mac

the "remove" menu on Book.app removes a book from all devices and removes from iCloud also. so we need to do

  1. finder
  2. search "epub"
  3. click one of search results
  4. click "Book" of "iCloud/Book" folder on the status bar
  5. right click one of epub list
var elements = document.getElementsByClassName("series-episode-list-container");
for (var i = 0; i < elements.length; i++) {
console.log(elements[i].getAttribute('href'));
}
@umjammer
umjammer / how to eliminate unremovable .crdownload file.md
Last active November 12, 2021 16:02
[MacOS] how to eliminate unremovable .crdownload file

how to eliminate unremovable google chrome .crdownload file

$ killall Dock
@umjammer
umjammer / jna_FunctionMapper.md
Last active January 24, 2022 06:08
[Java] JNA
    Map<String, Object> options = new HashMap<String, Object>() {{
        put(Library.OPTION_FUNCTION_MAPPER, new FunctionMapper() {
            public String getFunctionName(NativeLibrary library, Method method) {
Debug.println(method.getName());
                if (method.getName().equals("default")) {
                    return "defaultSession";
                } else {
                    return method.getName();
 }
@umjammer
umjammer / UniversalDetector.java
Last active March 14, 2022 16:18
[Java] universal character encoding detector snippet
private static String convert(byte[] buffer) {
UniversalDetector detector = new UniversalDetector(null);
detector.handleData(buffer, 0, buffer.length);
detector.dataEnd();
String value = null;
String encoding = detector.getDetectedCharset();
if (encoding != null) {
value = new String(buffer, 0, buffer.length, Charset.forName(encoding));
}
@umjammer
umjammer / mac_brew_openssl.patch
Last active March 14, 2022 16:20
[Emu] NP2Kai macos w/ brew sdl2, openssl patch
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 03e6f74..6f96592 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,13 @@ endif()
# Git
find_package(Git)
+find_library (
+ SSL_LIB
@umjammer
umjammer / patch_yarn_build.gradle.patch
Created July 21, 2020 04:58
[Minecraft] class name mapping for minecraft fabric mods without sources
diff --git a/build.gradle b/build.gradle
index 1fa8f09c3..c67345c3c 100644
--- a/build.gradle
+++ b/build.gradle
@@ -761,6 +761,23 @@ publishing {
}
}
+task mapYourJar(dependsOn: compressTiny) {
+ group = mapJarGroup