Skip to content

Instantly share code, notes, and snippets.

View brianfakhoury's full-sized avatar
☀️
felix culpa

Brian Fakhoury brianfakhoury

☀️
felix culpa
View GitHub Profile
@brianfakhoury
brianfakhoury / nft.sol
Created May 22, 2021 13:13
An NFT to track progress as JSON
// SPDX-License-Identifier: MIT
pragma solidity 0.8.0;
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol";
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol";
contract newNFT is NFTokenMetadata, Ownable {
constructor() {
nftName = "Practical Crypto Progress Token";
@brianfakhoury
brianfakhoury / registerCallback.sol
Last active April 1, 2021 04:09
Incentivize external caller for a contract job using incremental allocation.
pragma solidity ^0.8.1;
contract TimedCallbacks
{
struct Job { uint time; address addr; bytes data; uint reward; address creator; }
Job[] jobs;
function register(uint _time, address _addr, bytes calldata _data) external payable returns (uint index) {
index = jobs.length;
@brianfakhoury
brianfakhoury / fizzbuzz.py
Last active April 26, 2020 17:56
fizzbuzz one-liner in python
print(["fizzbuzz" if n % 15 == 0 else "fizz" if n % 3 == 0 else "buzz" if n % 5 == 0 else n for n in range(1, 34)])
@brianfakhoury
brianfakhoury / smooth_min_mem.c
Last active April 23, 2020 18:30
Highly precise, low-interpretation, image smoothing algorithm which iterates over an image array in memory, and make far less read/writes than normal.
typedef struct {
unsigned short red;
unsigned short green;
unsigned short blue;
} pixel;
char smooth2_descr[] = "smooth: NOT succint";
void smooth2(int dim, pixel *src, pixel *dst) {
int i = 0, j = 0;