Skip to content

Instantly share code, notes, and snippets.

View scammi's full-sized avatar

Santiago Cammi scammi

View GitHub Profile
it('Bonds and breaks a NFT', async() => {
const tokenId = 1;
const depositedTokenId = 2;
await nftMock.mint(deployer, tokenId).then(tx => tx.wait());
await nftMock.mint(deployer, depositedTokenId).then(tx => tx.wait());
// Create an account
const newAccountAddress = await registryContract.account(
chargedParticlesAccountAddress,
network.config.chainId ?? 137,
@scammi
scammi / Shuffle.sol
Created January 16, 2022 14:55
Implementation of Fisher-Yates Shuffle in solidity.
pragma solidity ^0.8.0;
contract Shuffle {
uint256[] public shuffle = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47];
uint256 public entropy = block.timestamp;
function shuffleArray() public {
for(uint256 i = shuffle.length -1 ; i > 0; i--) {
@scammi
scammi / Garden.sol
Created January 16, 2022 12:52
Water you plants in the ethereum garden
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/utils/Counters.sol";
contract Garden is ERC721 {
using Counters for Counters.Counter;
Counters.Counter private _tokenIdCounter;
constructor() ERC721("Garden", "GRD") {}
@scammi
scammi / gist:554040d5463a43939c724b019dbaf56a
Last active March 2, 2022 21:16
2FA_code_to_clipboard ~ amplyauth
//Dependencies
sudo apt-get install oathtool xclip
//Command
oathtool --totp --base32 TOKEN | xclip -selection clipboard
//Fish alias
alias amplyauth = "oathtool --totp --base32 TOKEN | xclip -selection clipboard"
//Bash script
@scammi
scammi / array_to_table.php
Last active August 24, 2021 14:01
PHP array to HTML table.
function array_to_html_table($array)
{
$table = '';
$table .= '<table style="width:100%; border:1px solid black; margin-bottom: 5px" border="1" cellspacing="0">';
foreach($array as $key => $row)
{
if($key == 0) // table header
{
$table .= '<thead><tr>';
@scammi
scammi / sync_notes.sh
Last active May 2, 2021 17:06
Sync notes
#!/bin/bash
while inotifywait -r -e modify,create,delete $1
do
rsync -rvz -e 'ssh -p 4321' --progress $1 [email protected]:Documents/Note
done
@scammi
scammi / note
Created January 26, 2021 14:29
Fast note taking with ghostwriter
#!/bin/bash
# install ghostwriter
# mv script to PATH
# chmod +x note
FILE=/$HOME/Documents/notes
if [ ! -d "$FILE" ]; then
mkdir $FILE
fi
@scammi
scammi / prepare-commit-msg.sh
Last active August 24, 2020 13:58
Prepending commit message
#!/bin/bash
# prepending commit message.
# 1. cd .git/hooks
# 2. rename prepare-commit-msg.sample to prepare-commit-msg
# 3. paste the script listed below and ensure that the file is executable
# http://blog.bartoszmajsak.com/blog/2012/11/07/lazy-developers-toolbox-number-1-prepend-git-commit-messages/
# This way you can customize which branches should be skipped when
if [ -z "$BRANCHES_TO_SKIP" ]; then