Skip to content

Instantly share code, notes, and snippets.

View r4zzz4k's full-sized avatar

Andrew Mikhaylov r4zzz4k

View GitHub Profile
@solarkraft
solarkraft / syncthing-automerge.py
Created December 30, 2022 18:00
Monitors a Syncthing-synced directory and tries to merge conflicting files (based on https://www.rafa.ee/articles/resolve-syncthing-conflicts-using-three-way-merge/). Probably adaptable for other directory types, but only tested with Logseq (works for me™️).
import os
import time
import re
import subprocess
from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler
def get_relative_path(path):
return os.path.relpath(path)
@ericfreese
ericfreese / git-rewrite
Last active July 5, 2022 20:16
Git script to rewrite history in various ways
#!/bin/env zsh
# Run an interactive rebase, automatically marking $1 to be reworded
function git_rewrite_reword() {
GIT_SEQUENCE_EDITOR="sed -ie 's/pick $1/reword $1/'" \
git rebase -i --autostash $1^
}
# Run an interactive rebase, automatically marking $1 to be edited
function git_rewrite_edit() {
/**
* @author themishkun on 24/07/2018.
*/
typealias ViewAction<View> = (View) -> Unit
@DslMarker
annotation class ViewStateDslMarker
/**
@Ribesg
Ribesg / !README.md
Last active June 20, 2022 15:00
How to use an iOS Framework in a Kotlin MPP library published to Maven

This gist demonstrates how to build a Kotlin MPP library so that the iOS sourceSet depends on and uses an iOS Framework as a dependency.

Key ideas:

  • We use [Carthage] to retrieve/build the iOS Framework.
  • We use [cinterop] to create bindings allowing us to use the iOS Framework from Kotlin
  • We build and publish the library using ./gradlew publishToMavenLocal
  • We build and publish [klib] artifacts for both the arm64 and x86_64 architectures, you can easily add arm32 if you need.
  • Note that the publish process also publishes a cinterop klib artifact, allowing dependents to also know about the iOS Framework headers.

You can find a gist explaining how to use such library in an iOS app [here][ios-app].

@benasher44
benasher44 / ios.gradle
Last active April 30, 2019 04:23
iOS Gradle Utilities for Generating Fat Frameworks and dSYMs
afterEvaluate {
// Create tasks for creating fat frameworks and fat dsyms for sim and device
def binaryKinds = [
// config, sim task, device task
new Tuple('Debug', linkDebugFrameworkIosSim, linkDebugFrameworkIosDevice),
new Tuple('Release', linkReleaseFrameworkIosSim, linkReleaseFrameworkIosDevice),
]
@qh-huang
qh-huang / jni_commonly_used_code.cpp
Last active October 20, 2023 08:54
JNI useful code pieces
// ==================== pull from Facebook/rockdb@github ====================
class ListJni {
public:
// Get the java class id of java.util.List.
static jclass getListClass(JNIEnv* env) {
jclass jclazz = env->FindClass("java/util/List");
assert(jclazz != nullptr);
return jclazz;
}