Skip to content

Instantly share code, notes, and snippets.

Avatar
🤓
deploying awesomeness

Jaka Hudoklin offlinehacker

🤓
deploying awesomeness
View GitHub Profile
@offlinehacker
offlinehacker / rxdb-external-attachments-storage.ts
Created Jul 11, 2022
RxDB plugin to allow storage of attachments in external storage
View rxdb-external-attachments-storage.ts
import {
BulkWriteRow,
EventBulk,
RxAttachmentData,
RxAttachmentWriteData,
RxDocumentData,
RxDocumentDataById,
RxJsonSchema,
RxStorage,
RxStorageBulkWriteResponse,
View .wslconfig
[wsl2]
kernel=C:\\Users\\JAKA\\vmlinux
@offlinehacker
offlinehacker / divide.py
Last active Mar 19, 2022
Devides list in all posible sublists, without repetitions
View divide.py
from itertools import combinations
def divide(l, p={}):
for v in (j for i in xrange(1, len(l) + 1) for j in combinations(l, i)):
r = tuple(set(l) - set(v))
for s in devide(r):
t = (v,) + (s if s else tuple())
if frozenset(t) in p: continue
else: yield t; p[frozenset(t)] = True
@offlinehacker
offlinehacker / dom.ts
Last active Mar 9, 2022
DOM functions
View dom.ts
export const getScrollParent = (node?: Element | null): Element | null => {
if (node == null) {
return null;
}
if (node.scrollHeight > node.clientHeight) {
return node;
} else {
return getScrollParent(asElement(node.parentNode));
}
@offlinehacker
offlinehacker / multipass-docker.yml
Created Mar 2, 2022
Multipass cloud config to create VM with docker installed
View multipass-docker.yml
#cloud-config
groups:
- docker
users:
- name: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users,docker,admin
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDwB83EYt+55hfu6SzIFKrZ7E8Vli2NaZ5E1vgieFslSGJfJGECfrK8m26/5US/W+Rjfgi9VR0L1zY92eld92134mQQFiPeGWpU88iUVykNmm6B8iA6I/AlzPa+qeZaH5iteWvUxqApZ1s0nFnIVA9PI9+OSzEX/nDrWEiNMxc2H1L0GIf/OAzCEs8WllVSHSqA35wuXQBkPDF6d+SMtRe6tZ82BT5InSFmWVP+TBREV2/okrgEJSF9exD8myXKuPqe4pCZqVgiHMi1NpGs/sDack/yuOHVT+eMKVE23j4r5zhvkMS4Y4oEpj4v0V8DChZSniMvhvp9qxKMJJKwKDWn
@offlinehacker
offlinehacker / google_stt.py
Created Jun 14, 2013
Quick and dirty python implementation of client for google speech to text service using google speech stream API. It requires requests, pyaudio and pyflac to be installed. Don't forget to set your API key. Current limit seems to be around 5 minutes.
View google_stt.py
#!/usr/bin/python
import flac.encoder as encoder
import pyaudio
import sys
import requests
import random
from threading import Thread
from Queue import Queue, Empty
@offlinehacker
offlinehacker / devcontainer.sh
Created Dec 1, 2021
Devcontainer env probe
View devcontainer.sh
#!/bin/bash
[[ $ENVRC_RUN != yes ]] && source /etc/envrc
# whether running via vscode env probe
if shopt -q login_shell && [[ "$BASH_EXECUTION_STRING" =~ $HOME/.vscode-server/bin/.*/node ]]; then
old_bash_path="$(which bash)"
if [ ! -z "${ENV_PRINT_COMMAND}" ]; then
cd "${WORKSPACE_DIR}"
View Dockerfile
FROM resin/armv7hf-debian-qemu
RUN [ "cross-build-start" ]
RUN apt-get update
RUN apt-get install -y python python-pip
RUN pip install virtualenv
RUN [ "cross-build-end" ]
@offlinehacker
offlinehacker / mergewithbase.py
Last active Jan 8, 2022
Merges result of function or attribute from child class with result of function or attribute from the base class.
View mergewithbase.py
class merge_with_base(object):
"""
Merges result of function or attribute from child class with result of
function or attribute from the base class.
:param type: Use this base class instead of first base class found and
not with mixins
.. note::
@offlinehacker
offlinehacker / aes_brute.sh
Created Mar 29, 2013
Simple shell AES brute forcer (especially usefull for bitcoin private keys)
View aes_brute.sh
#!/bin/bash
echo "Using wordlist $1"
echo "Using key $2"
cat $1 | while read LINE ; do
#echo "pass: $LINE"
key=$2
p1=${key:0:64}
p2=${key:64}
echo "$p1"$'\n'"$p2" > process
ret=$(openssl enc -d -aes-256-cbc -in process -a -k $LINE 2>/dev/null)