Skip to content

Instantly share code, notes, and snippets.

View BedrockDigger's full-sized avatar

Estel BedrockDigger

View GitHub Profile
@BedrockDigger
BedrockDigger / list.sh
Created January 24, 2025 18:10
List all packages installed by opkg.
opkg list-installed | awk '{print $1}' | sort | xargs
D === WP[[write(x)]](Z)
=== WP[[write(x)]](x=n^2)
=== x=n^2
WP[[b=t]](a<=b<=c)===a<=t<=c
WP[[a=b]](a<=t<=c)===b<=t<=c
WP[[t=a]](b<=t<=c)===b<=a<=c
WP[[a>b]](a<=b<=c, b<=a<=c)===(a<=b<=cANDa<=b)OR(b<=a<=cANDa>b)
===(a<=b<=c)OR(b<a<=c)
count t
(count) = aux t 0
To prove nodes t = count t, one can first prove acc + node t = aux t acc.
Generalized statement (*): acc + node t = aux t acc
Base Case: t = Empty
Statement being proven in base case: acc + node Empty = aux Empty acc
Proof of base case:
acc + node Empty
Generalized statement (*): acc + nlen n l = fold_left (+) acc (map (fun _ -> n) l)
---
Base Case: l = []
Statement being proven in base case: acc + nlen n [] = fold_left (+) acc (map (fun _ -> n) [])
Proof of base case:
acc + nlen n []
(nlen) = acc + match [] with [] -> 0 | h::t -> n + nlen n t
(match) = acc + 0
(arith) = acc
to prove mul c (sum l 0) 0 = c * summa l, one can prove the generalized statement mul c (sum l acc1) acc2 = acc2 + c * (summa l + acc1)
Lemma 1: sum l acc1 = acc1 + summa l
Base Case: l = []
Statement being proven in base case: sum [] acc1 = acc1 + summa []
Proof of base case:
sum [] acc1
(sum) = match [] with [] -> acc1 | h::t -> sum t (h+acc1)
(match) = acc1
(arith) = acc1 + 0
(match) = acc1 + (match [] with [] -> 0 | h::t -> h + summa t)
@BedrockDigger
BedrockDigger / farewell-to-uml.js
Created April 22, 2022 10:26
Let's leave the no-brainer - translating UML to skeleton class - alone.
const fieldsLiteral = `- name: String
- age: int
- tumId: String`
const funcsLiteral = `+ Person(String, int, String)
+ say(String): Shit`
printAttributes(fieldsLiteral)
printFunctions(funcsLiteral)
@BedrockDigger
BedrockDigger / getWordCountArray.java
Last active November 26, 2021 13:52
Use getWordCountArray() with WordCount.increment().
public WordCount[] getWordCountArray() {
// step 1: remove all leading and trailing ' 's
// step 2: remove extra ' 's between words
// step 3: remove all special chars
// step 4: all to lowercase
// step 5: add a leading space for traversion
String processedContent = " " + content.trim()
.replaceAll(" +", " ")
.replaceAll("[.;!?()*,]", "")
.toLowerCase();
DEVICE STUCK IN A BOOTLOOP AND UNABLE TO GRAB A LOG?
Forcing adb authorization will help you.
1. Reboot to TWRP
2. Mount _System
_ 3. Execute the following commands via adb
`adb shell 'echo "persist.service.adb.enable=1" >> default.prop'
@BedrockDigger
BedrockDigger / ai.service
Created November 6, 2021 23:21
Start Ai-Chan on boot and never let her down!
[Unit]
Description=Start Ai-Chan on boot and never let her down!
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
WorkingDirectory=/home/misskey/ai
ExecStart=/usr/bin/npm start
RestartSec=5
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<!-- REMOTES -->
<remote name="kangdom" fetch="https://github.com/kangdom/" />
<remote name="nazunamoe-device" fetch="https://github.com/nazunamoe-device" />
<!-- MANIFESTS -->
<!-- device trees -->
<project name="android_device_xiaomi_clover" path="device/xiaomi/clover" remote="kangdom" revision="exthm-11" />
<project name="android_device_xiaomi_sdm660-common" path="device/xiaomi/sdm660-common" remote="kangdom" revision="exthm-11" />
<!-- vendors -->