Skip to content

Instantly share code, notes, and snippets.

@hnOsmium0001
hnOsmium0001 / fabric.build.gradle
Created May 31, 2020 19:14
Minecraft mod publishing to Bintray
bintray {
user = findProperty('bintray.user')
key = findProperty('bintray.apiKey')
publications = ['BintrayPublication']
pkg {
repo = 'Maven'
name = '<your-artifact-id>'
licenses = ['<your-license>']
vcsUrl = '<your-git-repository-url>'
version {
@hnOsmium0001
hnOsmium0001 / WindowsGuiSubsystemWithMain.cmake
Last active July 27, 2021 18:27
CMake snippet to add to CMakeLists.txt to make some target use `int main()` while building to the GUI ("windows") subsystem.
# No console window when targetting windows
if(WIN32)
function(handle_gnu_style_compiler)
# Supposedly the flag -mwindows would automatically make the executable use GUI subsystem
# But, when subsystem is set to GUI, linker will only search WinMain and wWinMain but not the standard main (it seems like)
# so creating GUI executable fails and the linker silently reverts to the default, CUI subsystem
target_link_options(${TARGET_NAME} PRIVATE -Wl,-subsystem:windows)
target_link_options(${TARGET_NAME} PRIVATE -Wl,-entry:mainCRTStartup)
endfunction()
function(handle_msvc_style_compiler)
@hnOsmium0001
hnOsmium0001 / CraftJPlus.java
Created August 22, 2021 22:09
A general Java library, for syntax sugars and beautifuler implementations.
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.Scanner;
class StringView(
val string: String,
val offset: Int,
val length: Int,
) : Iterable<Char> {
constructor(string: String) : this(string, 0, string.length)
init {
val end = offset + length
assert(offset >= 0 && offset < string.length)
@hnOsmium0001
hnOsmium0001 / README.md
Created December 8, 2023 06:40
Doom Emacs org-mode CJK separate font

这份配置其实并不怎样。它工作原理是这样的:调用 (buffer-face-mode) 以替换当前buffer的默认face,而org-mode所用的各种face都会从默认face继承font-family。我也不太记得为什么要新建一个fontset而不是直接写 (font-spec :family "Blah") 以得到制定好中文字体的face了,大概和不用fontset没法正确设置ASCII范围字符有关吧。

说实话如果不管你用不用Doom Emacs,都应该直接用 (custom-theme-set-faces) 来直接操作 org-default 这个face,总会比这个方案靠谱一些……