Skip to content

Instantly share code, notes, and snippets.

View vmptk's full-sized avatar
🐉
Focusing

Venelin vmptk

🐉
Focusing
View GitHub Profile
@vmptk
vmptk / Dockerfile
Created February 6, 2024 23:20 — forked from Slach/Dockerfile
clickhouse with odbc, for docker-compose and kubernetes
FROM yandex/clickhouse-server:${CLICKHOUSE_VERSION:-latest}
USER root
ARG UBUNTU_NAME=focal
ARG UBUNTU_VERSION=20.04
RUN echo "Begin ODBC install" && \
#MySQL repo
wget -qO- "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0xa4a9406876fcbd3c456770c88c718d3b5072e1f5" | apt-key add - && \
echo "deb http://repo.mysql.com/apt/ubuntu/ ${UBUNTU_NAME} mysql-8.0" >/etc/apt/sources.list.d/mysql-oracle.list && \
@vmptk
vmptk / .gitlab-ci.yml
Created October 5, 2023 06:31 — forked from liemle3893/.gitlab-ci.yml
Gitlab CI with Nomad
# Disable the Gradle daemon for Continuous Integration servers as correctness
# is usually a priority over speed in CI environments. Using a fresh
# runtime for each build is more reliable since the runtime is completely
# isolated from any previous builds.
variables:
GRADLE_OPTS: "-Dorg.gradle.daemon=false"
DOCKER_TLS_CERTDIR: ""
before_script:
- export GRADLE_USER_HOME=`pwd`/.gradle
@vmptk
vmptk / States-v3.md
Created January 22, 2023 23:22 — forked from andymatuschak/States-v3.md
A composable pattern for pure state machines with effects (draft v3)

A composable pattern for pure state machines with effects

State machines are everywhere in interactive systems, but they're rarely defined clearly and explicitly. Given some big blob of code including implicit state machines, which transitions are possible and under what conditions? What effects take place on what transitions?

There are existing design patterns for state machines, but all the patterns I've seen complect side effects with the structure of the state machine itself. Instances of these patterns are difficult to test without mocking, and they end up with more dependencies. Worse, the classic patterns compose poorly: hierarchical state machines are typically not straightforward extensions. The functional programming world has solutions, but they don't transpose neatly enough to be broadly usable in mainstream languages.

Here I present a composable pattern for pure state machiness with effects,

package statemachine
import debug
import fail
import io.reactivex.Observable
import kotlinx.coroutines.experimental.channels.Channel
import kotlinx.coroutines.experimental.channels.produce
import kotlinx.coroutines.experimental.delay
import kotlinx.coroutines.experimental.launch
import kotlinx.coroutines.experimental.runBlocking
@vmptk
vmptk / DemoRepository
Created October 4, 2022 06:13 — forked from mobynote/DemoRepository
Use jdbcTemplate implement a pagination in spring
package com.domain;
import com.domain.Module;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;
@vmptk
vmptk / use-query-param.ts
Created August 16, 2022 18:55 — forked from albingroen/use-query-param.ts
useQueryParam
export default function useQueryParam<T>(
key: string,
push: (path: string) => void,
defaultValue?: T,
): [T, (value: T) => void] {
const { pathname, search } = location
const query = new URLSearchParams(search)
const rawValue = query.get(key)
@vmptk
vmptk / build_web3_apps.md
Created April 24, 2022 21:18 — forked from nguyer/build_web3_apps.md
Build Ethereum Web3 Apps Quickly Using the Latest Tools

Workshop Guide - Building Apps on FireFly

Welcome! We're glad you're here! This is the guide that we will be going through during the workshop.

Before the workshop

IMPORTANT: Please make sure you have installed the software listed in this section before the workshop so that we can hit the ground running when the workshop starts.

Install Docker

@vmptk
vmptk / .md
Created January 30, 2022 21:26 — forked from joepie91/.md
Running a Node.js application using nvm as a systemd service

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!


The original article

Trickier than it seems.

MongoDB Cheat Sheet

Show All Databases

show dbs

Show Current Database

class Square {
type = "Square" as const
constructor(public side: number) {}
}
class Circle {
type = "Circle" as const
constructor(public radius: number) {}
}
class Rectangle {
type = "Rectangle" as const