Skip to content

Instantly share code, notes, and snippets.

@meganukebmp
meganukebmp / extract_bmp.py
Created November 21, 2022 19:47
Dump raw images from binaries (with headers)
from pathlib import Path
import io
import sys
data = Path(sys.argv[1]).read_bytes()
l = len(data)
for index, b in enumerate(data):
if (b == 0x42 and data[index+1] == 0x4D):
x = int.from_bytes(data[index+2:index+6], byteorder="little", signed=False)
@meganukebmp
meganukebmp / los_gerrit_push.txt
Last active July 14, 2022 00:04 — forked from ghostrider-reborn/los_gerrit_push.txt
Push commit(s) in a repo to LOS Gerrit even if you're not in LOS env
# Push commits to LOS Gerrit
git push ssh://<gerrit-user-id>@review.lineageos.org:29418/LineageOS/<repo-name> HEAD:refs/for/<branch>
# Install change-id hooks first:
gitdir=$(git rev-parse --git-dir); scp -O -p -P 29418 <gerrit-user-id>@review.lineageos.org:hooks/commit-msg ${gitdir}/hooks/
@meganukebmp
meganukebmp / Make (MINGW).sublime-build
Created January 23, 2022 21:03
A Sublime Text build system integrating MINGW on Windows
{
"shell_cmd": "C:\\msys64\\usr\\bin\\env MSYSTEM=MINGW64 c:\\msys64\\usr\\bin\\bash -l -c \"cd \\$(cygpath -u '${folder:${project_path:${file_path}}}') && make\"",
"file_regex": "^(..[^:\n]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${folder:${project_path:${file_path}}}",
"selector": "source.makefile",
"syntax": "Packages/Makefile/Make Output.sublime-syntax",
"keyfiles": ["Makefile", "makefile"],
"variants":
[
@meganukebmp
meganukebmp / LineageDownloader.py
Created February 25, 2019 21:19
LineageOS batch downloader for archive purposes
import json
import urllib
import urllib.request
import os
import sys
import hashlib
# BUF_SIZE is totally arbitrary, change for your app!
BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
@meganukebmp
meganukebmp / rainbow.sh
Last active September 6, 2018 01:50
Generates a rainbow in bash (truecolor)
center=128
width=127
freq=0.06
rainbow() {
R=$(bc -l <<< "scale=2;s($freq*$1+2)*$width+$center")
G=$(bc -l <<< "scale=2;s($freq*$1+0)*$width+$center")
B=$(bc -l <<< "scale=2;s($freq*$1+4)*$width+$center")
echo "\x1b[38;2;${R%.*};${G%.*};${B%.*}m"
}
@meganukebmp
meganukebmp / alexa.js
Last active August 20, 2018 20:48
Alexa only exists to play despacito
var Discordie = require("discordie");
var client = new Discordie();
var fs = require("fs");
client.connect({ token: "" });
client.Dispatcher.on("GATEWAY_READY", e => {
console.log("Connected as: " + client.User.username);
});
11345920 > 10855680 - 270336
11341824
**Hack this to use precompiled kernel**
[build/core/Makefile]:1109
recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
TARGET_KERNEL_SOURCE
./device/motorola/msm8226-common/BoardConfigCommon.mk:50:TARGET_KERNEL_SOURCE := kernel/motorola/msm8226
./vendor/lineage/build/tasks/kernel.mk:24:# TARGET_KERNEL_SOURCE = Kernel source dir, optional, defaults
/*
+(c) 2017*/
#define /**/C(c/*
*/)char *o= #c;c
C(typedef char w;w*
t=" oh##! ]j% #f&"
"$ !j%&a^ )$! cc)"
"b ]$#_$$ !da )$_"
"^ %#]_#%! cb# $]'"
"a %b#%!i## ]]' #]_"
@meganukebmp
meganukebmp / lineage-15.1_falcon_libfm-hci.patch
Last active January 30, 2018 17:56
collection of patches for LineageOS 15.1 on Moto G devices. Primarily aimed towards titan, but might work on others.
--- hardware/qcom/fm/fm_hci/Android.mk.orig 2018-01-08 23:23:37.000000000 +0100
+++ hardware/qcom/fm/fm_hci/Android.mk 2018-01-09 19:24:52.341528746 +0100
@@ -13,8 +13,8 @@
libhidltransport \
libhwbinder \
liblog \
- libutils \
- vendor.qti.hardware.fm@1.0
+ libutils
+# vendor.qti.hardware.fm@1.0
var canvas = document.getElementById("canvas");
var ctx = canvas.getContext('2d');
var alert = document.getElementById("alert");
var pollX = 90;
var rocket = {
x: pollX,
y: canvas.height-100,
lastx: 0,