Skip to content

Instantly share code, notes, and snippets.

View itdaniher's full-sized avatar

itdaniher itdaniher

  • mosslandia
View GitHub Profile
@itdaniher
itdaniher / Dockerfile
Created November 5, 2020 00:47
leveldbjni for arm32 / armv7l
FROM adoptopenjdk/openjdk11:armv7l-debian-jdk-11.0.8_10
WORKDIR /app
RUN apt update && apt install -y wget
RUN wget -O /app/Amm https://github.com/lihaoyi/Ammonite/releases/download/2.2.0/2.12-2.2.0 && chmod +x /app/Amm
RUN apt install -y git build-essential automake unzip
# grab leveldb source and patch it
RUN git clone git://github.com/chirino/leveldb.git && cd leveldb && wget https://raw.githubusercontent.com/fusesource/leveldbjni/master/leveldb.patch && git apply ./leveldb.patch
# no make install target in leveldb, so manually copy libs
RUN cd /app/leveldb && make -j3 && cp libleveldb.* /usr/lib/
# grab native source blob from maven
@itdaniher
itdaniher / getLoadedNativeLibraries.scala
Created November 4, 2020 23:10
get a list of the loaded native libraries in the current jvm, in scala / ammonite
val libs = classOf[ClassLoader].getDeclaredField("loadedLibraryNames")
libs.setAccessible(true)
libs.get(ClassLoader.getSystemClassLoader).asInstanceOf[java.util.HashSet[String]].toArray
@itdaniher
itdaniher / flockhart.json
Created March 14, 2019 06:28
flockhart.json
{
"3a457": {
"substrates": {
"alfentanil": [
"Human alfentanil metabolism by cytochrome P450 3A3/4. An explanation for the interindividual variability in alfentanil clearance? [ PMID 8484504 ] Kharasch ED, Thummel KE. Anesth Analg 1993;76:1033-1039."
],
"alprazolam": [
"Alprazolam is another substrate for human cytochrome P450-3A isoforms. [ PMID 9617989 ] Venkatakrishnan K, Greenblatt DJ, von Moltke LL, Shader RI. JClin Psychopharmacol 1998 Jun;18(3):256."
],
"amlodipine": [
@itdaniher
itdaniher / common_and_latin_name.json
Last active March 29, 2023 20:50
common_and_latin_name.json
{
"7 Pot Brain Strain Red Pepper": "Capsicum chinense",
"7 Pot Bubble Gum Pepper": "Capsicum chinense",
"7 Pot Pepper Barrackpore": "Capsicum chinense",
"7 Pot Pepper Brain Strain Yellow": "Capsicum chinense",
"7 Pot Pepper Orange": "Capsicum chinense",
"7 Pot Pepper Yellow": "Capsicum chinense",
"7 Pot Pink Pepper": "Capsicum chinense",
"7 Pot Rust Pepper": "Capsicum chinense",
"Abe Lincoln Tomato": "Solanum lycopersicum",
@itdaniher
itdaniher / sshtunnel.conf
Created December 18, 2018 05:49
sshtunnel service
REMOTE_SSH_PORT_TO_BIND=8192
REMOTE_SSH_KEY_FULLPATH=/etc/sshtunnel.privkey
REMOTE_SSH_IP=255.255.255.255
REMOTE_SSH_USER=root
@itdaniher
itdaniher / make.sh
Last active October 26, 2018 20:07
compile sqlite4java for arm / arm64 / aarch64 / armv8
gcc -O2 -DNDEBUG -fpic -DARM -DARCH="ARM" -DLINUX -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_LITTLE_ENDIAN -fno-omit-frame-pointer -fno-strict-aliasing -static-libgcc -I./sqlite -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_STAT2 -DHAVE_READLINE=0 -DSQLITE_THREADSAFE=1 -DSQLITE_THREAD_OVERRIDE_LOCK=-1 -DTEMP_STORE=1 -DSQLITE_OMIT_LOAD_EXTENSION=1 -DSQLITE_OMIT_DEPRECATED -DSQLITE_OS_UNIX=1 -c ./sqlite/sqlite3.c -o sqlite3.o
gcc -O2 -DNDEBUG -fpic -DARM -DARCH="ARM" -DLINUX -D_LARGEFILE64_SOURCE -D_GNU_SOURCE -D_LITTLE_ENDIAN -fno-omit-frame-pointer -fno-strict-aliasing -static-libgcc -I./sqlite -I/usr/lib/jvm/default-java/include -I/usr/lib/jvm/default-java/include/linux -DSQLITE_ENABLE_COLUMN_METADATA -DSQLITE_ENABLE_FTS3 -DSQLITE_ENABLE_FTS3_PARENTHESIS -DSQLITE_ENABLE_MEMORY_MANAGEMENT -DSQLITE_ENABLE_STAT2 -DHAVE_READLINE=0 -DSQLITE_THREADSAFE=
@itdaniher
itdaniher / fail.py
Created September 21, 2018 18:02
😑
import asyncio
import sys
async def test():
1//0
loop = asyncio.get_event_loop()
def asyncio_handler(loop, context):
print("XXXX", "got", context)
@itdaniher
itdaniher / config
Created September 19, 2018 23:57
sim7100a config from /proc/config.gz
#
# Automatically generated make config: don't edit
# Linux/arm 3.0.21 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_HAVE_SCHED_CLOCK=y
CONFIG_GENERIC_GPIO=y
# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
CONFIG_GENERIC_CLOCKEVENTS=y
We couldn’t find that file to show.
@itdaniher
itdaniher / trng_r1dx.py
Created June 29, 2018 21:20
true random number generator based (d20) dice roller, verified fair
f = open('/dev/urandom', 'rb')
default_n = 1000000
max_r = 256
def r1dx(x=20):
while True:
# get one byte, take as int on [1,256]
r = int.from_bytes(f.read(1), 'little')+1
# if byte is less than the max factor of 'x' on the interval max_r, return r%x+1
if r < (max_r-(max_r%x)+1): return (r%x)+1