Skip to content

Instantly share code, notes, and snippets.

View ra0x3's full-sized avatar
🔥
fuego

rashad ra0x3

🔥
fuego
View GitHub Profile
@ra0x3
ra0x3 / hello-world.lib.rs
Last active April 27, 2023 14:22
Example indexer lib
extern crate alloc;
use fuel_indexer_macros::indexer;
use fuel_indexer_plugin::prelude::*;
#[indexer(manifest = "tech_talk.manifest.yaml")]
pub mod tech_talk_index_mod {
fn tech_talk_handler(block_data: BlockData) {
Logger::info("Processing a block. (>'.')>");
@ra0x3
ra0x3 / playground.marlowe
Last active March 22, 2021 22:48
ADA MakerSpace Examples 1
When
[Case
(Deposit
(Role "escrow")
(Role "buyer")
(Token "" "")
(Constant 500)
)
(When
[Case

Keybase proof

I hereby claim:

  • I am aar3 on github.
  • I am raa3 (https://keybase.io/raa3) on keybase.
  • I have a public key ASCuIE6-nZyE8KDZZLRSZ6mJc3STl4lpvgTQf4egvYeA7go

To claim this, I am signing this object:

@ra0x3
ra0x3 / sample_join_output.json
Created March 5, 2020 18:55
Sample output of peewee join
{
"reason" : null,
"code" : 200,
"message" : "ok",
"data" : [
{
"id" : 1,
"type" : "messages",
"attributes" : {
"read_at" : null,
@ra0x3
ra0x3 / managers.py
Last active March 6, 2020 17:21
A sample model manager demonstrating how joins work
from peewee_extensions import PeeweeExtensions
class BaseManager:
def __init__(self, name):
self.model_name = name
self.exts = PeeweeExtensions(self)
self.model = BaseManager.model_for(self.model_name)
self.relations = self.model._meta.relations
@staticmethod
@ra0x3
ra0x3 / models.py
Created March 4, 2020 05:08
A sample messages model in peewee
from peewee import (
BaseModel,
ForeignKeyField,
TextField,
IntegerField,
DateTimeField,
CharField
)
from peewee_extensions import (
@ra0x3
ra0x3 / peewee_extensions.py
Created March 4, 2020 05:01
Helper classes to allow recursive automatic joins in peewee
class Direct:
def __init__(self, native_key, foreign_key):
"""
Represents a direct relationship from one 'native'
model, to one 'foreign' model
"""
self.native_key = native_key
self.foreign_key = foreign_key
@ra0x3
ra0x3 / attrs-demo.js
Last active November 11, 2019 23:50
model attributes rfc
// app/core/model-builder.js
class ModelBuilder {
// still using a wrapper function over `defineAttribute`, that
// creates default options via instance chanining. this will
// reduce boiler plate in the model manager files
formAttribute(attr, options) {
return this.defineAttribute(attr, options)
.certifiable()
@ra0x3
ra0x3 / results.csv
Created November 5, 2019 20:18
Results of sequential vs concurrent compute tasks
Type Timeit Iters Tasks Factor Range Threads Seconds CPU Usage
sequential 1000 10 10e5 - 10e8 1 46 100%
concurrent 1000 10 10e5 - 10e8 2 57 50%
sequential 1000 20 10e10 - 10e12 1 816 100%
concurrent 1000 20 10e10 - 10e12 2 391 7%
@ra0x3
ra0x3 / main.py
Created November 5, 2019 19:45
Compare factorization sequentially vs concurrently
import os
import sys
import random
from typing import *
N_TASKS = 20
UPPER_BOUND = 10e12
LOWER_BOUND = 10e10
def sequential_factorization():