This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
contract AssemblyArray { | |
function bar(uint[] calldata x, uint256 y) external pure | |
returns (uint256 offset, uint256 length, uint256 x0, uint256 x1, uint256 y0) { | |
assembly { | |
calldatacopy(0x0,4,36) | |
// x offset | |
calldatacopy(0x20,68,100) // x length | |
calldatacopy(0x40,100,132) // x[0] | |
calldatacopy(0x60,132,164) // x[1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
contract AssemblyAddr { | |
function foo() public returns (uint256){ | |
assembly{ | |
mstore(0x0,caller) | |
return(0x0,32) | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
contract StorageOptimization { | |
uint16 a; | |
uint16 b; | |
uint16 c; | |
uint16 d; | |
uint64 e; | |
uint128 f; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
contract DynamicArray { | |
uint256[] store; | |
function getAssembly(uint256 _idx) external view returns(uint256 _value) { | |
bytes32 dir = keccak256(abi.encodePacked(uint256(0))); // stored at slot 0 | |
assembly{ | |
_value := sload(add(dir,_idx)) // access to keccak256 of slot 0 plus offset |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity >=0.4.22 <0.6.0; | |
contract Mapping { | |
mapping(string => uint256) store; // stored at slot 0 | |
function getAssembly(string calldata _key) external view returns(uint256 _value) { | |
bytes32 dir = keccak256(abi.encodePacked(_key,uint256(0))); // concatenation of key and slot | |
assembly{ | |
_value := sload(dir) // load value |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# inputDate.sh | |
# inserta fechas en todos los ficheros de un directorio | |
# variables | |
MAX_FILES=1000 | |
DIRECTORY="files" | |
# generamos el directorio | |
if [ ! -d "$DIRECTORY" ]; then |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"files.exclude": { | |
"**/.git": true, | |
"**/.svn": true, | |
"**/.hg": true, | |
"**/CVS": true, | |
"**/.DS_Store": true, | |
"**/*.aux": true, | |
"**/*.out": true, | |
"**/*.nav": true, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use-strict' | |
const process = require('process') | |
const fs = require('fs') | |
const filename = process.argv.slice(process.argv.length - 1, process.argv.length)[0] | |
const data = fs.readFileSync(filename, { encoding: 'utf-8' }) | |
const lines = data.split('\n').map((line) => line.trim()) | |
let dataWant = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '3.2' | |
services: | |
neo4j: | |
image: 'neo4j:3.5.11' | |
ports: | |
- '7474:7474' | |
- '7473:7473' | |
- '7687:7687' | |
volumes: | |
- type: 'bind' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Print variable name with the variable value | |
printVariable() { | |
variableName=$1; | |
variableValue=$(eval "echo -n \$$1"); | |
echo "$variableName=$variableValue"; | |
} |