Skip to content

Instantly share code, notes, and snippets.

Avatar

Julien Lucca lucca65

View GitHub Profile
View docker-compose.yml
version: "3"
services:
builder:
build:
context: builder
image: eosio/builder:v1.2.2
nodeosd:
container_name: nodeosd
View gradients.css
.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 Sep 30, 2017
web3_example.js
View newWeb3.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) {
View charlinho.cpp
#include <iostream>
#include <cmath>
#include <climits>
using namespace std;
const int MAX_N = 510;
const int MAX_K = 510;
int N, K;
View hub.ex
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 Mar 10, 2017
Gen server that handle nerves nodes changing its IP and updates its node name
View network_fail_handler.ex
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 Dec 7, 2016
Prime number simple cluster implementation
View client.exs
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 Dec 7, 2016
Word list problem Elixir implementation
View word_list.exs
defmodule WordFreq.Parser do
def work do
read_file
|> to_list
|> group
|> transform
|> Enum.take(10)
end
@doc """
View bomb.c
/*
* DO NOT COMPILE AND RUN UNLESS YOU KNOW WHAT YOU ARE DOING.
* This is a 29 byte C code that compiles to a 17,179,875,837 byte (16 GB) executable.
* Author: Digital Trauma (codegolf.stackexchange.com/users/11259/digital-trauma)
* This defines the main function as a large array and initialises its first element.
* This causes GCC to store the entire array in the resulting executable.
* Because this array is bigger than 2GB,
* we need to provide the -mcmodel=medium flag to GCC.
* The extra 15 bytes are included in the score, as per the rules.
* Compile with:
You can’t perform that action at this time.