Skip to content

Instantly share code, notes, and snippets.

[Desktop Entry]
Name=Browser chooser
Exec=/usr/local/bin/crostini-browser.sh %U
MimeType=text/html;x-scheme-handler/http;x-scheme-handler/https;x-scheme-handler/ftp;x-scheme-handler/mailto;
Type=Application
NoDisplay=true
OnlyShowIn=Never
@ephemient
ephemient / iwatch
Created December 21, 2022 12:39
Run a command whenever changes are detected by inotify
#!/bin/bash
set -euo pipefail
declare -a ARGS=() INOTIFY_ARGS
while (($#)); do
case $1 in
--) break;;
*) ARGS+=("$1");;
esac
shift
done
import java.lang.reflect.Parameter
import java.util.stream.Stream
import kotlin.reflect.KFunction
import kotlin.reflect.KParameter
import kotlin.reflect.full.callSuspendBy
import kotlin.reflect.full.functions
import kotlin.reflect.full.hasAnnotation
import kotlin.reflect.full.isSubtypeOf
import kotlin.reflect.full.isSupertypeOf
import kotlin.reflect.typeOf
{
"include" : [
"default/direct"
],
"define": {
"keymap": {
"A-k": "set-input-mode-hiragana",
"A-l": "set-input-mode-latin",
"C-j": "convert-hiragana",
"C-k": "convert-katakana",
@ephemient
ephemient / share-polyfill.user.js
Created May 27, 2022 04:56
Web Share Polyfill
// ==UserScript==
// @name Web Share Polyfill
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Implements Web Share API using clipboard and downloads
// @author ephemient
// @include https://*/*
// @grant none
// @run-at document-start
// ==/UserScript==
@ephemient
ephemient / invert.html
Created May 9, 2022 06:14
Invert black and white while maintaining colors
<style>
img {
filter: url(#invert);
}
</style>
<svg style="display: none;">
<defs>
<filter id="invert">
<feColorMatrix in="SourceGraphic" type="matrix" values="0.402 -1.174 -0.228 0 1 -0.598 -0.174 -0.228 0 1 -0.598 -1.174 0.772 0 1 0 0 0 1 0"></feColorMatrix>
import android.os.Parcel
import kotlinx.parcelize.Parceler
import kotlinx.serialization.BinaryFormat
import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
/**
* This class allows any [kotlinx.serialization.Serializable] type to be easily used within a
* [kotlinx.parcelize.Parcelize] type without implementing [android.os.Parcelable].
*
@ephemient
ephemient / .SRCINFO
Created April 1, 2021 19:39
ki-shell
pkgbase = ki-shell
pkgdesc = Kotlin Language Interactive Shell
pkgver = 0.3.2
pkgrel = 1
url = https://github.com/Kotlin/kotlin-interactive-shell
arch = any
license = APACHE
depends = java-runtime
source = https://repo1.maven.org/maven2/org/jetbrains/kotlinx/ki-shell/0.3.2/ki-shell-0.3.2-archive.zip
md5sums = af50d913bd362facf6b4244b1a682c0f
From: Daniel Lin <ephemient@gmail.com>
Date: Thu, 11 Feb 2021 15:54:17 -0500
Subject: [PATCH] resolve: configure systemd-resolved's MulticastDNS= setting
When using iwd.conf:[General].EnableNetworkConfiguration=true, it is not
possible to configure systemd.network:[Network].MulticastDNS= as
systemd-networkd considers the link to be unmanaged. This patch allows
iwd to configure that setting on systemd-resolved directly.
---
src/iwd.config.rst | 9 ++++++
#include <fcntl.h>
#include <stdlib.h>
#include <unistd.h>
int main() {
int pipefd[2];
close(0);
close(1);
pipe(pipefd);
write(1, "echo $Q\n", 8);
execle("/bin/sh", "sh", NULL, (char *[]) {"Q=echo $Q", NULL});