Skip to content

Instantly share code, notes, and snippets.

View Rami-Majdoub's full-sized avatar
💻
Necesito Programar Màs

Rami Majdoub Rami-Majdoub

💻
Necesito Programar Màs
View GitHub Profile
merge-dev(){
current_branch="$(git branch --show-current)"
git checkout dev
git pull
git checkout "$current_branch"
git merge dev
}
gitbackup(){
today=$(date +%F-%H-%M)
import { Wallet } from "ethers";
async function main() {
// const wallet = new Wallet("private key")
// const wallet = Wallet.fromMnemonic("mnemonic")
const wallet = Wallet.createRandom();
console.log(`Wallet mnemonic: ${wallet.mnemonic.phrase}`);
console.log(`Wallet encrypted:`);
console.log(await wallet.encrypt(""));
#!/bin/bash
# BASEDIR=$1;
# for file in `ls -1 $BASEDIR*.{jpeg}`; do
# echo "$file" "$(date -r "$BASEDIR/$file" +"%Y-%m-%d_%H-%M-%S").jpg"
# done
# ls | egrep '\.mp4$|\.mp3$|\.exe$'
# for file in `ls -1 $BASEDIR | egrep '\.jpeg$'`; do
//////////// uint
uint8(x) , x £ [0, 255] = [0x00, 0xff] = [0, 2^8 - 1]
uint16(x) , x £ [0, 65535] = [0, 2^16 - 1]
uint24(x) , x £ [0, 16777215] = [0, 2^24 - 1]
uint32(x)
uint40(x)
...
uint256(x) , x £ [0, 2^256 - 1]
//////////// int
@Rami-Majdoub
Rami-Majdoub / README.md
Created September 13, 2022 12:39
send multiple transaction at once and wait for them to be mined

run script

npx hardhat run scripts/hardhat-send-multiple-txs.ts --network goerli

result

Sending funds
Tx sent: nonce: 11 | hash: 0xcc25e7c4ea0aec0726f28ae0bbdfd438cbcb9a78b4571610219171b500533ea8
Tx sent: nonce: 12 | hash: 0x5851f016b17772c479df1adb98406a1b3bb7a8f44f6418aec9b5d7c0895217ff
@Rami-Majdoub
Rami-Majdoub / README.md
Last active September 13, 2022 12:48
Time reminder

Warning the script will run the next time you start the device

# download script
curl https://gist.githubusercontent.com/Rami-Majdoub/7b5d171989470f4db623e10be47062c1/raw/92ee98501fe130ba86b32096ee59c72d6f0066df/time_reminder.sh > ~/time_reminder.sh

# make script runnable
@Rami-Majdoub
Rami-Majdoub / last_login.sh
Created July 7, 2022 19:06
Startup Application Command: bash /home/rami/last_login.sh
#!/bin/sh
date +%F_%T_%a >> ~/last_login.txt
@Rami-Majdoub
Rami-Majdoub / get public key.ts
Created March 17, 2022 05:15 — forked from Breta01/get public key.ts
Requesting the public key from MetaMask
// Account is account address provided as string
// App must have access to the specified account
const account = "0x012...bc"
// Key is returned as base64
const keyB64 = await window.ethereum.request({
method: 'eth_getEncryptionPublicKey',
params: [account],
}) as string;
const publicKey = Buffer.from(keyB64, 'base64');
@Rami-Majdoub
Rami-Majdoub / .deps...remix-tests...remix_accounts.sol
Created December 14, 2021 22:19
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.10+commit.fc410830.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.4.22 <0.9.0;
library TestsAccounts {
function getAccount(uint index) pure public returns (address) {
address[15] memory accounts;
accounts[0] = 0x5B38Da6a701c568545dCfcB03FcB875f56beddC4;
accounts[1] = 0xAb8483F64d9C6d1EcF9b849Ae677dD3315835cb2;
@Rami-Majdoub
Rami-Majdoub / README.md
Last active August 12, 2024 02:02
remove UNREGISTERED from StarUML
  • export as SVG (File > Export Diagram As > SVG... > Save)
  • open SVG file in web browser
  • open console and run
document.querySelectorAll("text").forEach(e => e.innerHTML = e.innerHTML === "UNREGISTERED"? "":e.innerHTML)
  • take screenshot