Skip to content

Instantly share code, notes, and snippets.

View lucca65's full-sized avatar

Julien Lucca lucca65

View GitHub Profile
@lucca65
lucca65 / supabase.prisma
Created November 11, 2023 14:29
Prisma file with models from Supabase
model audit_log_entries {
instance_id String? @db.Uuid
id String @id @db.Uuid
payload Json? @db.Json
created_at DateTime? @db.Timestamptz(6)
ip_address String @default("") @db.VarChar(64)
@@index([instance_id], map: "audit_logs_instance_id_idx")
@@schema("auth")
}
@lucca65
lucca65 / docker-compose.yml
Created September 6, 2018 02:40
Esse funciona!
version: "3"
services:
builder:
build:
context: builder
image: eosio/builder:v1.2.2
nodeosd:
container_name: nodeosd
.gradient-blue {
background: #283c86;
background: -webkit-gradient(linear, left top, right top, from(#45a247), to(#283c86)) !important;
background: linear-gradient(to right, #45a247, #283c86) !important
}
.gradient-love {
background: #cc2b5e;
background: -webkit-gradient(linear, left top, right top, from(#cc2b5e), to(#753a88)) !important;
@lucca65
lucca65 / newWeb3.js
Last active September 30, 2017 00:06
web3_example.js
const web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"))
const abi = JSON.parse('. . .')
const address = '0x593b851932dAFdf8573Ed7891518b1Ba5B0d5838'
const contract = web3.eth.contract(abi).at(address)
contract.setMessage("I'm picke Rick motherfucker!", {
value: web3.toWei('10', 'finney'),
from: '0x004fC1D0F9C8d126418ab466b03A4B0E55422B64'
}, (error, result) => {
if (error) {
#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
const int MAX_N = 510;
const int MAX_K = 510;
int N, K;
defmodule Hub do
@moduledoc """
Publish/subscribe server.
Subscription is done with a pattern.
Example:
{:ok, _pid} = Hub.start_link(name: :hub)
Hub.subscribe(:hub, %{count: count} when count > 42)
@lucca65
lucca65 / network_fail_handler.ex
Created March 10, 2017 02:20
Gen server that handle nerves nodes changing its IP and updates its node name
defmodule MyApp.DistributionManager do
use GenServer
require Logger
@app Mix.Project.config[:app]
def start_link(iface) do
GenServer.start_link(__MODULE__, iface)
end
@lucca65
lucca65 / client.exs
Last active December 7, 2016 19:55
Prime number simple cluster implementation
defmodule Worker do
def start do
pid = spawn(__MODULE__, :loop, [])
send(server_pid, {:request, pid})
pid
end
def server_pid do
:global.whereis_name("server")
end
@lucca65
lucca65 / word_list.exs
Created December 7, 2016 19:46
Word list problem Elixir implementation
defmodule WordFreq.Parser do
def work do
read_file
|> to_list
|> group
|> transform
|> Enum.take(10)
end
@doc """