Skip to content

Instantly share code, notes, and snippets.

View maxpushka's full-sized avatar
💡
Mode: Idea overflow

Max Pushkarov maxpushka

💡
Mode: Idea overflow
View GitHub Profile
@maxpushka
maxpushka / application.properties
Created March 31, 2024 21:25
Postgres-to-NATS CDC with Debezium
# Debezium source connector configuration
debezium.source.connector.class=io.debezium.connector.postgresql.PostgresConnector
debezium.source.offset.storage.file.filename=data/offsets.dat
debezium.source.offset.flush.interval.ms=0
debezium.source.database.hostname=postgres
debezium.source.database.port=5432
debezium.source.database.user=postgres
debezium.source.database.password=postgres
debezium.source.database.dbname=postgres
debezium.source.topic.prefix=events
package precision
import (
"math"
"github.com/shopspring/decimal"
)
func ToSignificant(input decimal.Decimal, sigDigits int32, maxScale int32) decimal.Decimal {
if input.Equal(decimal.Zero) {
use proc_macro::TokenStream;
use quote::{format_ident, quote};
use syn::{parse_macro_input, Data, DeriveInput, Fields};
#[proc_macro_derive(FieldsFromStruct)]
pub fn fields_from_struct_derive(input: TokenStream) -> TokenStream {
let input = parse_macro_input!(input as DeriveInput);
let visibility = &input.vis;
let enum_name = format_ident!("{}Fields", input.ident);
@maxpushka
maxpushka / digits.go
Last active October 27, 2023 07:40
decimal.Decimal to significant figures converter
package digits_decimals
import (
"strings"
"unsafe"
"github.com/shopspring/decimal"
)
type params struct {
@maxpushka
maxpushka / digits.go
Last active October 11, 2023 13:51
float to significant figures converter
package digits
import "math"
func ToSignificant(x float64, significantDigits, maxDecimals uint) float64 {
if x == 0.0 {
return 0.0
}
intX := math.Floor(x)
# graphics.py
"""Simple object oriented graphics library
The library is designed to make it very easy for novice programmers to
experiment with computer graphics in an object oriented fashion. It is
written by John Zelle for use with the book "Python Programming: An
Introduction to Computer Science" (Franklin, Beedle & Associates).
LICENSE: This is open-source software released under the terms of the
GPL (http://www.gnu.org/licenses/gpl.html).

Keybase proof

I hereby claim:

  • I am maxpushka on github.
  • I am maxpushka (https://keybase.io/maxpushka) on keybase.
  • I have a public key ASBCV_-mek0Q760Gj0qJAB0jL3dBeXO1N00dbjxxn7EmOgo

To claim this, I am signing this object:

@maxpushka
maxpushka / tk.py
Last active December 2, 2021 09:46
from tkinter import *
def click():
def add_holiday():
ibox.insert(END, entry2.get())
win1.destroy()
win1 = Toplevel()
win1.title('Введення нового свята')
label3 = Label(win1, text = 'Введiть нове свято')
label3.pack(padx = 3, pady = 3)
#include <iostream>
#include <vector>
#include <cstdlib>
#include <ctime>
#include <conio.h>
#include "windows.h"
using namespace std;
bool gameOver = false;
int gcd(const int& n, const int& m) {
int a = n, b = m;
if (b > a) swap(a, b);
while (b) {
a = a % b;
swap(a, b);
}
return a;
}