Skip to content

Instantly share code, notes, and snippets.

View ice09's full-sized avatar

Alexander C. ice09

View GitHub Profile
@ice09
ice09 / icon_builder.py
Last active February 5, 2024 12:49
Python script for MCPI to create a 2 dimensional 8 color blocks based on a Python array.
import sys
import mcpi.block as block
from mcpi.minecraft import Minecraft
from math import *
# Data structure representing icon as a 2D grid
# Copy the generated array from the BlockCraft chat
image = [[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
[7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7],
@ice09
ice09 / main.py
Created January 31, 2024 06:22
Ampelgehampel in Micropython for Raspberry Pico
# Transfer with Thonny
from machine import Pin, Timer
import utime
# Initialize LEDs
led1_r = Pin(2, Pin.OUT)
led1_y = Pin(3, Pin.OUT)
led1_g = Pin(4, Pin.OUT)
led2_r = Pin(6, Pin.OUT)
led2_y = Pin(7, Pin.OUT)
@ice09
ice09 / TalkToEmbeddedButerin.java
Last active October 25, 2023 08:08
Downloads three posts of Vitaliks blog and creates embeddings with langchain4j which can then be queried with OpenAI GPT (see https://hackmd.io/@alculexum/embedding4j)
//DEPS dev.langchain4j:langchain4j:0.23.0
//DEPS dev.langchain4j:langchain4j-open-ai:0.23.0
//DEPS dev.langchain4j:langchain4j-embeddings-all-minilm-l6-v2:0.23.0
//DEPS commons-io:commons-io:2.14.0
//DEPS org.apache.commons:commons-text:1.10.0
//DEPS org.jsoup:jsoup:1.16.1
//DEPS org.slf4j:slf4j-simple:2.0.9
package dev.indus340;
@ice09
ice09 / CRCTCConverter.sol
Last active June 23, 2022 14:25
CirclesUBI Timecircles to Circles Converter
// SPDX-License-Identifier: AGPL
pragma solidity ^0.8.0;
import "./CRCTCConverterLib.sol";
contract CRCTCConverter {
function crcToTc(uint timestamp, uint amount) external pure returns (uint) {
uint precision = 10 ** 18;
@ice09
ice09 / ECRecover.java
Last active May 22, 2022 09:18
Creates a signature from a private key, signs a message and ecrecover in Java. Hashes are equal to Solidity and recoverSigner works with values generated in Java in Solidity ECTools below. Uses web3j.
public class ECRecover {
private void pkDisplay() {
//0x627306090abaB3A6e1400e9345bC60c78a8BEf57
String privateKey1 = "c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3";
Credentials credentials = Credentials.create(privateKey1);
System.out.println("pk:" + Numeric.toHexStringNoPrefix(credentials.getEcKeyPair().getPublicKey()));
String message = "now that's a text";
String label = "\u0019Ethereum Signed Message:\n"+ String.valueOf(message.getBytes().length) + message;
@ice09
ice09 / README.md
Created March 28, 2022 15:29
Most Simple Spring Boot JPA PostgreSQL Sample

Instructions for Linux/WSL2

  1. Create local volume for PostgreSQL data mkdir postgres-data
  2. Use Postgres Docker image, Create Container storage with DB storage, User storage, and Password storage docker run -d --name storage -e POSTGRES_USER=storage -e POSTGRES_PASSWORD=storage -e PGDATA=/var/lib/postgresql/data/pgdata -e POSTGRES_DB=storage -p5432:5432 -v $PWD/postgres-data:/var/lib/postgresql/data postgres
  3. Create Spring Boot Minimal JPA with PostgreSQL https://start.spring.io/#!type=maven-project&language=java&platformVersion=2.6.5&packaging=jar&jvmVersion=11&groupId=dev.wcs.minijpa&artifactId=local-storage&name=local-storage&description=Sample%20Project%20for%20a%20Minimal%20JPA%20with%20local%20Persistence%20using%20PostgreSQL&packageName=dev.wcs.minijpa.local-storage&dependencies=postgresql,data-jpa
@ice09
ice09 / ZipCityConverter.java
Last active February 24, 2022 09:13
ZipCityConverter as Quarkus JBang sample application
///usr/bin/env jbang "$0" "$@" ; exit $?
// Update the Quarkus version to what you want here or run jbang with
// `-Dquarkus.version=<version>` to override it.
//DEPS io.quarkus:quarkus-bom:${quarkus.version:1.11.0.Final}@pom
//DEPS io.quarkus:quarkus-resteasy
//DEPS io.quarkus:quarkus-resteasy-jackson
//DEPS io.quarkus:quarkus-smallrye-openapi
//DEPS io.quarkus:quarkus-swagger-ui
//Q:CONFIG quarkus.swagger-ui.always-include=true
//FILES germany_zip_codes.json
@ice09
ice09 / docker-compose.yml
Last active December 3, 2021 09:19
Docker Compose for Full Blockchain Event Streaming Sample
version: '3'
services:
blockchain-listener-fs:
image: blockchain-listener:0.0.1-SNAPSHOT
container_name: blockchain-listener-fs
restart: on-failure
depends_on:
- neo4j-writer-fs
- rdbms-writer-fs

y8zm1lynyq

@ice09
ice09 / circles.csv
Created April 25, 2021 08:55
Some CirclesUBI Numbers
We can make this file beautiful and searchable if this error is corrected: It looks like row 3 should actually have 1 column, instead of 2. in line 2.
# Users with most outgoing trusts
# MATCH (tr:User)-[r:TRUSTS]->(te:User)
# RETURN tr AS Truster, COUNT(r)
# ORDER BY COUNT(r) DESC
Truster,COUNT(r)
"{""name"":cuinima1,""address"":0xBFB9749A89376565C79e17050842413F3AB43821,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/285246319f75cbb68f35154d4fa019043ded41ea2ae6010b7156e7ea8c6c099e.jpg}",3297
"{""name"":cuinima3,""address"":0x674Ee4c8B66f54c91e62fe49EadFA1A70b5b8DA4,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/609392f19687b3f5c6454b467a539843258bff229fc270c8b7624b575034b850.jpg}",2843
"{""name"":cuinima,""address"":0xD5eFcB307623728989E0431277C6230c2666cA69,""image_url"":https://circles-ubi.s3.amazonaws.com/uploads/avatars/22072a6eafe63a2a10e6dbd7acf6ed72fa4d0d79e6ca4adbcb0c919626dcf8b4.jpg}",2330
"{""name"":f4az3zl8ek,""address"":0xCb5D036b9661D119003C487915b18F7118Cdb8eE}",967