Skip to content

Instantly share code, notes, and snippets.

View emekoi's full-sized avatar
📚

Emeka Nkurumeh emekoi

📚
View GitHub Profile
@emekoi
emekoi / deploy-page.sh
Last active December 1, 2023 05:06
deploy a github pages website locally
#!/usr/bin/sh
set -e
[ -n "$BUILD_COMMAND" ]
head="$(git rev-parse --abbrev-ref HEAD)"
site_branch="${1:-gh-pages}"
build_dir="${2:-build}"
@emekoi
emekoi / m.c
Last active October 15, 2023 04:07
search upwards for a `Makefile` to run, or until any file called `.git` is found
/* SPDX-License-Identifier: MIT
* Copyright (c) 2023 Emeka Nkurumeh
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
data Extend x b r = Extend {-# UNPACK #-}b {-# UNPACK #-}r
deriving (Functor)
instance (KnownSymbol x, Show b, Show r) => Show (Extend x b r) where
show (Extend e r) = "{" ++ symbolVal @x undefined ++ " : " ++ show e ++ " | " ++ show r ++ "}"
instance {-# OVERLAPPING #-} HasField x (Extend x a r) a where
getField (Extend x _) = x
instance {-# OVERLAPPABLE #-} (HasField x r a) => HasField x (Extend x' a' r) a where
@emekoi
emekoi / rem.go
Last active August 9, 2023 18:11
martin rem's union find
type Rem struct {
arc []int
}
func NewRem(n int) *Rem {
a := make([]int, n)
for i := range a {
a[i] = i
}
return &Rem{
#!/usr/bin/sh
set -e
files="$(fd -e .el .)"
sd -s '^\\\\\\\\begin{code}' '^[\t ]*\```\s*haskell.*?' $files
sd -s '\\\\begin{code}' '```\s*haskell.*?' $files
sd -s '\\begin{code}' '```\s*haskell.*?' $files
sd -s '^\\\\\\\\end{code}' '^[\t ]*\```' $files
@emekoi
emekoi / android-backup-apk-and-datas.md
Created July 19, 2021 04:30 — forked from AnatomicJC/android-backup-apk-and-datas.md
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Fetch application APK

To get the list of your installed applications:

#include <stdio.h>
#include <stdlib.h>
void **evil(void **label) {
if (label) goto *label;
label0:
puts("hello from here");
return &&label1;
diff --git a/src/ui/statusbar.rs b/src/ui/statusbar.rs
index bd554c7..61ffd0a 100644
--- a/src/ui/statusbar.rs
+++ b/src/ui/statusbar.rs
@@ -143,7 +143,8 @@ impl View for StatusBar {
);
printer.with_color(style_bar_bg, |printer| {
- printer.print((0, 0), &"┉".repeat(printer.size.x));
+ printer.print((0, 0), &" ".repeat(printer.size.x));
@emekoi
emekoi / comment.md
Last active June 6, 2021 13:29
ppx_yojson deriver for variant types

serializing the name of the constructor is necessary to remove ambiguity when deserializing the types. i had this same issue so i wrote this deriver that you can use alongside ppx_yojson_conv like so:

type step = [
  | `Run of RunStep.t
  | `Use of UseStep.t
]
[@@deriving yojson, yojson_var]

type job = {
 runs_on: string; [@key "runs-on"]
pub const GLvoid = c_void;
pub const GLenum = c_uint;
pub const GLfloat = f32;
pub const GLint = c_int;
pub const GLsizei = isize;
pub const GLbitfield = c_uint;
pub const GLdouble = f64;
pub const GLuint = c_uint;
pub const GLboolean = u8;
pub const GLubyte = u8;