Skip to content

Instantly share code, notes, and snippets.

@korczis
korczis / README.md
Last active October 27, 2024 00:14
NetworkGraph - KuzuDB DSL Real World Example

Kuzu.App.NetworkGraph

The Kuzu.App.NetworkGraph module defines a network schema using Kuzu.Graph.Schema. This schema models social and professional relationships between individuals, companies, posts, and comments, allowing for robust querying and data modeling for network-based applications.

Overview

The module is designed to represent social and professional connections in a network graph. Key entities include Person, Company, Post, and Comment, each with specific attributes. Relationships define how these entities interact within the network, including social relationships (friendships, follows), professional relationships (employment, management), and content interactions (authorship, likes, comments).

Example Use Cases

@korczis
korczis / query_stream.ex
Created September 4, 2024 17:24
Query Stream - Transform your Ecto Query into Stream!
defmodule Ecto.QueryStream do
@moduledoc """
A module to create a stream from an Ecto query.
This module provides functionality to stream results from an Ecto query in a paginated manner.
It is useful for handling large datasets efficiently by loading records in batches.
## Example Usage
query = from u in User, where: u.age > 30

Keybase proof

I hereby claim:

To claim this, I am signing this object:

# Edit this configuration file to define what should be installed on
# your system. Help is available in the configuration.nix(5) man page
# and in the NixOS manual (accessible by running ‘nixos-help’).
{ config, pkgs, ... }:
{
imports =
[ # Include the results of the hardware scan.
./hardware-configuration.nix
Last login: Wed Aug 14 10:38:51 on ttys027
korCZis-452069:~ korczis$ cd dev
korCZis-452069:dev korczis$ cd tmp
korCZis-452069:tmp korczis$ git clone [email protected]:template-automation/nest-egg-be.git
fatal: destination path 'nest-egg-be' already exists and is not an empty directory.
korCZis-452069:tmp korczis$ rm -rf ./*
korCZis-452069:tmp korczis$ git clone [email protected]:template-automation/nest-egg-be.git
Cloning into 'nest-egg-be'...
remote: Enumerating objects: 1505, done.
remote: Counting objects: 100% (1505/1505), done.

Keybase proof

I hereby claim:

  • I am korczis on github.
  • I am korczis (https://keybase.io/korczis) on keybase.
  • I have a public key ASAADjKlRI_2kW2kkTV4PWWYVEbsNdfPdUw-1S5PU3Ko7Ao

To claim this, I am signing this object:

function add(a, b) {
return a + b
}
@korczis
korczis / gist:20561d3c49522eab2b689185b425e4ae
Created August 30, 2016 09:37 — forked from lukas-vlcek/gist:4673027
Čeština v elasticsearch
#!/bin/sh
# download
wget http://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.20.4.zip
# unzip and start
unzip elasticsearch-0.20.4.zip
cd elasticsearch-0.20.4
# remove data in case you have defined some analyzers in the past (e.g. stop/start)
rm -rf data/
pub fn inode_get_project(inode: u64) -> u16 {
(inode >> 48) as u16
}
pub fn inode_get_category(inode: u64) -> u8 {
((inode >> 40) & 0xff) as u8
}
pub fn inode_get_item(inode: u64) -> u32 {
((inode >> 8) & 0xffffffff) as u32
@korczis
korczis / triangulate-topojson.js
Last active May 8, 2016 09:10
Triangulate Topojson ( => Geojson) using earcut.js
import earcut from 'earcut';
import topojson from 'topojson';
import math from 'mathjs';
const triangulateTopojson = (res) => {
const totalStart = performance.now();
const key = Object.keys(res.objects)[0];
let start = performance.now();
const geojson = topojson.mesh(res, res.objects[key]);