Skip to content

Instantly share code, notes, and snippets.

View tristanperalta's full-sized avatar

Tristan Peralta tristanperalta

View GitHub Profile
@tristanperalta
tristanperalta / Oracle.sol
Created December 11, 2018 09:48
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.4.24+commit.e67f0147.js&optimize=true&gist=
pragma solidity 0.4.24;
// File: openzeppelin-solidity/contracts/ownership/Ownable.sol
/**
* @title Ownable
* @dev The Ownable contract has an owner address, and provides basic authorization control
* functions, this simplifies the implementation of "user permissions".
*/
contract Ownable {
@tristanperalta
tristanperalta / convert.js
Created October 31, 2018 03:15
convert utf-8 string to hex string
function toHex(str) {
return Buffer.from(str, 'utf-8').toString('hex');
}
console.log(toHex('tristan'));

Keybase proof

I hereby claim:

  • I am tristanperalta on github.
  • I am tristanperalta (https://keybase.io/tristanperalta) on keybase.
  • I have a public key ASDaIgxk1-NbEQLjXNEKjiwdKbgZvgzw2MyyWJiat03ERAo

To claim this, I am signing this object:

<!-- collapsable wrapped in data-collpasable attribute
has 2 sub-element in it, (1) Header and (2) Collapsable-block.
If Header is wrapped in collapsable block it will automatically add a dropdown
on the left side of the text. Collapsable block are the ones that show and
hide when header is clicked. -->
<div data-collapsable="">
<h2>First div</h2>
<div class="collapsable-block">
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. In elementum
@tristanperalta
tristanperalta / bitcoin_pub.rb
Last active August 29, 2015 13:56
Bitcoin Publisher
require 'eventmachine'
require 'amqp'
require 'bitcoin-client'
txn_id = ARGS[0]
client = Bitcoin::Client.new(blah)
wallet_address = client.get_wallet_address(txn_id)
EM.run do
require 'uri'
require 'net/http'
require 'json'
uri = URI('http://www.reddit.com/r/showerthoughts.json')
response = Net::HTTP.get_response(uri)
json = JSON.parse(response.body)
title = json["data"]["children"][rand(25)]["data"]["title"]
puts title