Skip to content

Instantly share code, notes, and snippets.

View antomor's full-sized avatar
🎯
Focusing

Antonio Morrone antomor

🎯
Focusing
View GitHub Profile
{
"name": "franklin-contracts",
"version": "0.1.0",
"license": "MIT",
"devDependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.0",
"@nomiclabs/hardhat-etherscan": "^2.1.0",
"@nomiclabs/hardhat-solpp": "^2.0.0",
"@nomiclabs/hardhat-waffle": "^2.0.0",
"@typechain/ethers-v5": "^3.0.0",
@antomor
antomor / procedure-to-archive-git-branches.md
Created December 27, 2022 14:54 — forked from zkiraly/procedure-to-archive-git-branches.md
Procedure to archive git branches.
@antomor
antomor / whoami.json
Created February 9, 2022 08:47
whoami.json
{"id": "4be19430264ba409f67d318897b61a6134220d8781885bf13516e0a10414c3dc94dd61d7df835881982215e53e9776490e1dfcec697f4f8a3d030fac95abe23a"}
@antomor
antomor / clone_and_push.bash
Created August 12, 2021 13:04
make a private fork of a public repo
# from https://stackoverflow.com/a/30352360/6816965
# 1. clone the publish repo and push it into the private one
git clone --bare https://github.com/exampleuser/public-repo.git
cd public-repo.git
git push --mirror https://github.com/yourname/private-repo.git
cd ..
rm -rf public-repo.git
# 2. work on the private repository as usual
@antomor
antomor / check_merge_conflicts.sh
Created July 28, 2021 17:18
Check merge conflicts
git merge --no-commit --no-ff <BRANCH-TO-MERGE>
echo $?
git merge --abort
@antomor
antomor / git.migrate
Created May 4, 2021 06:59 — forked from CESARDELATORRE/git.migrate
Move your existing git repository # to a new remote repository
#!/bin/bash
# Sometimes you need to move your existing git repository
# to a new remote repository (/new remote origin).
# Here are a simple and quick steps that does exactly this.
#
### OPTION 1 ###########################################################################################
# Let's assume we call "old repo" the repository you wish
# to move, and "new repo" the one you wish to move to.
#
@antomor
antomor / delete.sh
Created January 2, 2021 15:47
Delete all node_modules folders
# Mac/Linux
find . -name 'node_modules' -type d -prune -print -exec rm -rf '{}' \;
# Windows
FOR /d /r . %d in (node_modules) DO @IF EXIST "%d" rm -rf "%d"
@antomor
antomor / TenIntegers.py
Created December 27, 2020 11:17
Iterable, iterator and generator
class TenIntegers:
def __init__(self, start_from=0):
self.current=start_from
self.max = self.current + 10
def __iter__(self):
'''
This method makes the object iterable
'''
@antomor
antomor / retry.js
Last active October 21, 2020 19:30
A js function that tries to execute a function n times, waiting before the next attempt, and with the possibility to set a initial delay.
const wait = (milliSeconds) => {
return new Promise((resolve) => setTimeout(() => resolve(), milliSeconds));
};
const retry = ({fn, maxRetries, initialDelayMs, intervalMs}) => {
// first attempt after the initial delay
let attempts = wait(initialDelayMs);
if ( maxRetries > 0) {
attempts = attempts.then(() => fn());
}
@antomor
antomor / wait.js
Last active October 21, 2020 17:07
It includes a wait function that returns a promise to be waited, it is also possible to specify a cancelToken, to stop waiting.
const wait = (milliSeconds) => {
return new Promise((resolve) => setTimeout(() => resolve(), milliSeconds));
};
wait(200).then(() => {
// your code
});
// async/await context
await wait(200);