Skip to content

Instantly share code, notes, and snippets.

View imkiva's full-sized avatar
🍥
fall in love with @SEmmmer

Kiva imkiva

🍥
fall in love with @SEmmmer
View GitHub Profile
@imkiva
imkiva / ovfyes
Last active August 4, 2023 07:53
ovfyes - Configuring ubuntu server with properties from VMware vApps
#!/usr/bin/env bash
RUN_ONCE_FILE="/etc/ovfyes-run-once"
RUN_EACH_BOOT_FILE="/etc/ovfyes-run-each-boot"
NETPLAN_FILE="/etc/netplan/00-installer-config.yaml"
OFVENV_DEBUG="$(cat <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<Environment
@imkiva
imkiva / x86-64_inline_hook.c
Last active March 9, 2023 09:44
Hook demo
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#include <stdint.h>
int some(int n) {
return n + 1;
}
open import Paths
open data Nat | zero | suc Nat
open data Unit | unit
open data Empty
open data U
| ℕ'
| Π' (A : U) (B : El A → U) (resp~ B)
def resp~ {A : U} (B : El A → U) : Type
@imkiva
imkiva / Bug.java
Last active August 26, 2022 09:02
Java bug
import java.util.function.BiFunction;
public class Bug {
sealed interface Term {
record Lit() implements Term {}
record Lam(String x, Term a) implements Term {}
}
public static <X, T> void call(BiFunction<X, T, T> op, X x, T t) {
op.apply(x, t);
@imkiva
imkiva / PLCTReport.java
Last active August 2, 2022 08:37
PLCT Auto Report
package org.aya.plct;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonDeserializer;
import com.google.gson.annotations.SerializedName;
import kala.collection.immutable.ImmutableSeq;
import kala.tuple.Tuple;
import kala.tuple.Tuple2;
import org.aya.pretty.doc.Doc;
import org.jetbrains.annotations.NotNull;
@imkiva
imkiva / remove-preview-minor-version.c
Last active April 12, 2022 03:37
Strip away preview feature minor version from `.class` file
#include <stdio.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/mman.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
struct Head {
@imkiva
imkiva / utlc.aya
Last active October 29, 2021 15:30
untyped lambda calculus in various languages
--| Basic definitions of natural numbers, booleans and deBruijn indices
--------------------------------------------------------------------------------
open data Nat : Type | zero | suc Nat
open data Bool : Type | true | false
open data DBI : Type | Dbi Nat
def infix ==' (a b : Nat) : Bool
| zero, zero => true
| zero, suc b => false
| suc a, zero => false
@imkiva
imkiva / Emacs.applescript
Last active March 22, 2021 12:18
Open emacs cli editing the file selected in Finder.app
on run {input, parameters}
tell application "Finder"
set flist to selection as alias list
if length of flist = 0 then
set fpath to ""
else
set fpath to quoted form of POSIX path of first item of flist
end if
end tell
@imkiva
imkiva / 📊 Weekly development breakdown
Last active May 4, 2024 00:14
📊 Weekly development breakdown
TableGen 1 hr 29 mins █████▍░░░░░░░░░░░░░░░ 26.1%
TableGe... 1 hr 4 mins ███▉░░░░░░░░░░░░░░░░░ 18.9%
Other 56 mins ███▍░░░░░░░░░░░░░░░░░ 16.4%
Text 34 mins ██▏░░░░░░░░░░░░░░░░░░ 10.1%
LLVM 28 mins █▊░░░░░░░░░░░░░░░░░░░ 8.5%
@imkiva
imkiva / get-stack.sh
Created December 26, 2017 16:12
Get calling stack in bash
get_stack() {
STACK=""
# to avoid noise we start with 1 to skip get_stack caller
local i
local stack_size=${#FUNCNAME[@]}
for (( i=1; i<$stack_size ; i++ )); do
local func="${FUNCNAME[$i]}"
[ x$func = x ] && func=MAIN
local linen="${BASH_LINENO[(( i - 1 ))]}"
local src="${BASH_SOURCE[$i]}"