Skip to content

Instantly share code, notes, and snippets.

@bertani
bertani / test.html
Created September 27, 2022 09:23
test
Hey <b>there</b>!
@bertani
bertani / DieselPricePeg.sol
Created June 28, 2018 15:29
Oraclize examples
/*
Diesel Price Peg
This contract keeps in storage a reference
to the Diesel Price in USD
*/
pragma solidity ^0.4.0;
import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";
function findEXIFinJPEG(file) {
var dataView = new DataView(file);
if (debug) console.log("Got file of length " + file.byteLength);
if ((dataView.getUint8(0) != 0xFF) || (dataView.getUint8(1) != 0xD8)) {
if (debug) console.log("Not a valid JPEG");
return false; // not a valid jpeg
}
var offset = 2,
0x9f228abf67b56cf4d60fb5e83b8b0719dc7b222f
0x435Fef83140602E770c0C1a1A2ba4Cb56eF5Cca1
@bertani
bertani / Dockerfile
Created April 25, 2017 11:02
Oraclize computation-ds logs-example ( ipfs/Qmb5HNh13zUwm3hqn6MectfD2rMUv7ReXvNgfhN2uxzKpD )
FROM ubuntu:14.04
MAINTAINER Oraclize "info@oraclize.it"
COPY script.sh /tmp/
CMD /bin/bash /tmp/script.sh
function strConcat(string _a, string _b, string _c, string _d, string _e, string _f, string _g) internal returns (string) {
bytes memory _ba = bytes(_a);
bytes memory _bb = bytes(_b);
bytes memory _bc = bytes(_c);
bytes memory _bd = bytes(_d);
bytes memory _be = bytes(_e);
bytes memory _bf = bytes(_f);
bytes memory _bg = bytes(_g);
string memory abcdefg = new string(_ba.length + _bb.length + _bc.length + _bd.length + _be.length + _bf.length + _bg.length);
bytes memory babcdefg = bytes(abcdefg);
contract LCS {
function toLowerCase(string _in){// returns (string){
bytes memory _out_b = bytes(_in);
byte tmp;
for (uint i=0; i<_out_b.length; i++){
tmp = _out_b[i];
if (tmp < 91) _out_b[i] = byte(int(tmp)+32);
}
//return string(_out_b);
}