Skip to content

Instantly share code, notes, and snippets.

@RomarQ
RomarQ / EntropyProvider.sol
Created March 1, 2023 07:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.18+commit.87f61d96.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: None
pragma solidity ^0.8.0;
contract EntropyProvider {
bytes entropy;
uint last_update;
address processor;
constructor(address _processor) {
processor = _processor;
@RomarQ
RomarQ / EntropyProvider.sol
Created February 28, 2023 19:57
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.19+commit.7dd6d404.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.0;
contract EntropyProvider {
bytes entropy;
uint last_update;
address processor;
constructor(address _processor) {
processor = _processor;
}
@RomarQ
RomarQ / contracts...client.sol
Created January 18, 2023 16:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.5.17+commit.d19bba13.js&optimize=false&runs=200&gist=
pragma solidity ^0.8.17;
contract IBCF_Client {
// The action counter is used in the Tezos blockchain for ordering the actions sequentially and as replay attack prevention.
uint action_counter;
// Proof slot
mapping(uint => string) action_registry;
/**
* Modifier to increase the action counter
@RomarQ
RomarQ / git.md
Created September 13, 2022 07:12
Git Cheat Sheet

Delete all remote branches but main.

git branch -r | grep -v "main" | cut -d/ -f2- | while read line; do git push origin :heads/$line; done;
@RomarQ
RomarQ / rust.md
Last active June 2, 2022 05:25
Rust Cheat Sheet

Rust Cheat Sheet

Bubble sort

fn bubble_sort<T: Ord + Copy>(mut list: Vec<T>) -> Vec<T> {
    for i in 0 .. list.len() {
        for j in i .. list.len() {
            if list[i] > list[j] {
                list.swap(i, j);
@RomarQ
RomarQ / go.md
Last active June 1, 2022 18:10
Go Cheat Sheet

Go Cheat Sheet

Get map keys

func GetMapKeys[K comparable, V any](m map[K]V) []K {
	keys := make([]K, 0)

	for k := range m {
		keys = append(keys, k)
@RomarQ
RomarQ / linux.md
Last active May 20, 2022 21:25
Linux

Linux Cheat Sheet

List all PCI devices

lspci

List available kernels

ls -l /lib/modules
@RomarQ
RomarQ / typescrypt.md
Last active March 17, 2022 16:02
Typescript Cheat Sheet

Typescript Cheat Sheet

Make all properties in T optional

/**
 * Make all properties in `T` optional
 
 * @typeParam T - Object
 */
@RomarQ
RomarQ / http_streaming.md
Created June 18, 2019 22:41 — forked from CMCDragonkai/http_streaming.md
HTTP Streaming (or Chunked vs Store & Forward)

HTTP Streaming (or Chunked vs Store & Forward)

The standard way of understanding the HTTP protocol is via the request reply pattern. Each HTTP transaction consists of a finitely bounded HTTP request and a finitely bounded HTTP response.

However it's also possible for both parts of an HTTP 1.1 transaction to stream their possibly infinitely bounded data. The advantages is that the sender can send data that is beyond the sender's memory limit, and the receiver can act on