Skip to content

Instantly share code, notes, and snippets.

@Razikus
Razikus / index.ts
Created June 23, 2023 07:48
Supabase immudb vault hook
// Follow this setup guide to integrate the Deno language server with your editor:
// https://deno.land/manual/getting_started/setup_your_environment
// This enables autocomplete, go to definition, etc.
import { serve } from "https://deno.land/std@0.168.0/http/server.ts"
import * as postgres from 'https://deno.land/x/postgres@v0.17.0/mod.ts'
console.log("FUNCTION VAULTSIGN LOADED")
const databaseUrl = Deno.env.get('SUPABASE_DB_URL')!
const secret = Deno.env.get('APIKEY_SECRET_INTEREXCHANGE')!
@Razikus
Razikus / vault.py
Last active November 15, 2023 19:27
Immudb Vault Simple Example
import requests
API_KEY = "YOUR API KEY"
resp = requests.put("https://vault.immudb.io/ics/api/v1/ledger/default/collection/default/document", headers = {
"X-API-KEY": API_KEY,
"content-type": "application/json"
}, json = {
"reddit": "Welcome!"
@Razikus
Razikus / pagination.py
Last active November 15, 2023 19:26
Simple pagination in immudb
from immudb.client import ImmudbClient
import uuid
MAX_N = 2000
def main():
client = ImmudbClient("localhost:3322")
client.login("immudb", "immudb", "defaultdb")
client.sqlExec("""CREATE TABLE IF NOT EXISTS pagination( ID INTEGER AUTO_INCREMENT, VALUE VARCHAR[255], PRIMARY KEY(ID) )""")
for index in range(0, MAX_N):
print("Adding records...", index, f"{round((index / MAX_N) * 100, 2)}%")
@Razikus
Razikus / main.py
Last active July 6, 2022 17:33
immudb example for creating table with index
from immudb import ImmudbClient
import time
class ExampleClient:
def __init__(self, immudbUrl, login, password, database):
self.immudbUrl = immudbUrl
self.login = login
self.password = password
self.database = database
self.client = ImmudbClient(immudbUrl)
version: '2'
services:
traefik:
build:
context: traefik
dockerfile: Dockerfile.template
command:
- --entrypoints.web.address=:80
- --providers.docker=true
- --providers.docker.exposedbydefault=false
<style>
body {
background: url("{{msg.payload}}") no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
#Home_Default {
display: none;
[{"id":"9f1559dc.1c6748","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"dff0b9e8.e718a8","type":"ui_template","z":"9f1559dc.1c6748","group":"5b65b30a.de7e4c","name":"","order":0,"width":0,"height":0,"format":"<img src=\"{{msg.payload}}\"/>","storeOutMessages":true,"fwdInMessages":true,"resendOnRefresh":true,"templateScope":"local","x":540,"y":380,"wires":[[]]},{"id":"d6aa0132.a2191","type":"mqtt in","z":"9f1559dc.1c6748","name":"","topic":"testtest","qos":"2","datatype":"auto","broker":"27edd438.632cac","x":280,"y":380,"wires":[["dff0b9e8.e718a8"]]},{"id":"86450727.888b18","type":"inject","z":"9f1559dc.1c6748","name":"","topic":"","payload":"https://www.testhr.pl/img/logo.png","payloadType":"str","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":270,"y":300,"wires":[["1aec40e6.85496f"]]},{"id":"1aec40e6.85496f","type":"mqtt out","z":"9f1559dc.1c6748","name":"","topic":"testtest","qos":"","retain":"","broker":"27edd438.632cac","x":570,"y":300,"wires":[]},{"id":"b66b8ef8.f4fa9","type":
#/bin/mount -o bind / writeable/
#/bin/mount -o remount,rw / writeable/
tmpfs /tmp tmpfs nosuid,nodev 0 0
tmpfs /var/log tmpfs nosuid,nodev 0 0
tmpfs /var/tmp tmpfs nosuid,nodev 0 0
proc /proc proc defaults 0 0
PARTUUID=x /boot vfat defaults,ro 0 2
PARTUUID=xx / ext4 defaults,noatime,ro 0 1
@Razikus
Razikus / yamlunion.py
Created October 22, 2019 20:29
For the situation, where you have 2 yaml files, one is older, but fits in 50% of bigger, and bigger have just new keys, then you don't want to do something from beginning, and consider the script that will just join 2 files, but take objects that exists from the bigger file, uff.
import ruamel.yaml as yamler
import ruamel
import sys
def main():
resultDict = dict()
if(len(sys.argv) < 4):
print("USAGE: script biggerYaml smallerYaml resultfile")
print("If entry is in smaller yaml - it will go to result")
print("If entry is not in smaller yaml - it will take it from biggerYaml")
sys.exit(1)
@Razikus
Razikus / assets
Created October 10, 2019 19:42
Minecraft 1.14 asset list from index
icons/icon_16x16.png
icons/icon_32x32.png
icons/minecraft.icns
minecraft/icons/icon_16x16.png
minecraft/icons/icon_32x32.png
minecraft/icons/minecraft.icns
minecraft/lang/af_za.json
minecraft/lang/ar_sa.json
minecraft/lang/ast_es.json
minecraft/lang/az_az.json