Skip to content

Instantly share code, notes, and snippets.

View sgerodes's full-sized avatar

sgerodes sgerodes

View GitHub Profile
@sgerodes
sgerodes / gist:70795cee37a644081a59e0c404273122
Created May 23, 2019 11:30
Change "origin" of your GIT repository
$ git remote rm origin
$ git remote add origin git@github.com:username/repositoryName.git
$ git config master.remote origin
$ git config master.merge refs/heads/master
{
"config": {
"data": "market-pairs",
"symbol": "'USDT'",
"limit": 100,
"page": 0
},
"usage": {
"day": 6,
"month": 14
{
"config": {
"data": "assets",
"symbol": "'USDT'",
"interval": "hour",
"data_points": 24
},
"usage": {
"day": 5,
"month": 13
This file has been truncated, but you can view the full file.
{
"config": {
"data": "market",
"type": "fast"
},
"usage": {
"day": 1,
"month": 1
},
"data": [
@sgerodes
sgerodes / sort_10.sol
Created August 3, 2023 09:34
Solidity sort 10 in the most gas efficient way
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.18;
contract Level_2_Solution {
function solution(uint256[10] calldata unsortedArray)
external pure returns (uint256[10] memory) {
uint256[10] memory sortedArray = unsortedArray;
if(sortedArray[0] > sortedArray[8]) {
(sortedArray[0], sortedArray[8]) = (sortedArray[8], sortedArray[0]);
Share any code fast
@sgerodes
sgerodes / gist:aef60ce1dd2dda681c45c59d6b9357e0
Last active January 13, 2024 05:05
PBA assignment 2 tests
use super::*;
use super::test_utils::*;
pub fn wallet_with_alice() -> Wallet {
Wallet::new(vec![Address::Alice].into_iter())
}
mod tests {
use super::*;
use super::*;
fn empty_wallet() -> Wallet {
Wallet::new(vec![].into_iter())
}
pub fn wallet_with_alice() -> Wallet {
Wallet::new(vec![Address::Alice].into_iter())
}
@sgerodes
sgerodes / gist:97c5c37d2cbf98f561264e4f6728d703
Created January 17, 2024 14:20
Asignment 3, What to ttest
# test ideas
//! - Only signed extrinsics are accepted, so you will learn signature verification.
//! - Basic calls for testing/learning, mainly represented in [`shared::RuntimeCall::System`].
//! - Basic currency system.
//! - Basic staking/reserving system.
//! - Nonce system, to prevent replay attacks and similar issues.
//! - Tipping, which is there to mimic transaction fee payment.
//! Checks that must happen in apply phase are those that are mandatory to make sure a blockchain is
//! sound and safe. These include:
//! # FRAME-less Runtime
//!
//! Welcome to the `FRAME-less` exercise, the fourth edition.
//!
//! > This assignment is based on Joshy's experiment years ago to explore building a Substrate
//! > runtime using pure Rust. If you learn something new in this exercise, attribute it to his
//! > work.
//!
//! Parts of this assignment resembles the `mini_substrate` section of the pre-course material. It
//! is recommended to re-familiarize yourself with that if you have done it. Nonetheless, everything