Skip to content

Instantly share code, notes, and snippets.

View djuanit0x's full-sized avatar
🚀
The future is fast

djuanit0x djuanit0x

🚀
The future is fast
  • UCSD
  • San Diego, California
View GitHub Profile
@djuanit0x
djuanit0x / .bash_profile
Created October 16, 2018 17:26 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@djuanit0x
djuanit0x / click.gif
Last active September 28, 2019 21:06
㊙️djuanit0x's secret weapon
click.gif
@djuanit0x
djuanit0x / .profile
Created July 6, 2019 13:23 — forked from bmhatfield/.profile
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@djuanit0x
djuanit0x / truffle-config.js
Last active July 22, 2019 06:51
provable-bitcoin-price
module.exports = {
networks: {
development: {
host: process.env.DEVELOPMENT_HOST,
port: 8545,
network_id: "*", // Match any network id
gas: 4700000
},
}
};
@djuanit0x
djuanit0x / BitcoinPrice.sol
Created July 22, 2019 07:22
provable-bitcoin-price
pragma solidity ^0.5.0;
import './provableAPI_0.5.sol';
contract BitcoinPrice is usingProvable {
string public GET_BITCOIN_PRICE_QUERY = "json(https://api.coingecko.com/api/v3/coins/markets?vs_currency=usd&order=market_cap_desc&per_page=1&page=1&sparkline=false).0.current_price";
event LogNewProvableQuery(string description);
event LogNewProvableResult(string result);
mapping (bytes32 => bool) public pendingQueries;
string public result;
@djuanit0x
djuanit0x / dockerfile.truffle
Created July 22, 2019 07:37
provable-bitcoin-price
FROM node:9-alpine
RUN rm -rf /var/cache/apk/* && \
mkdir /app
WORKDIR /app
RUN apk update && \
apk upgrade && \
apk --update add python py-pip git make g++ && \
apk add --no-cache bash && \
npm install --unsafe-perm -g truffle@5.0.0-beta.2 && \
@djuanit0x
djuanit0x / dockerfile.bridge
Created July 22, 2019 07:39
provable-bitcoin-price
FROM node:carbon-alpine
RUN apk --virtual dependencies add --update git python make g++ gcc && \
rm -rf /tmp/* /var/cache/apk/*
WORKDIR /usr/app
RUN git clone https://github.com/provable-things/ethereum-bridge .
@djuanit0x
djuanit0x / docker-compose.yml
Created July 22, 2019 07:47
provable-bitcoin-price
version: '3'
services:
ganache:
image: trufflesuite/ganache-cli:v6.1.0
command: ganache-cli -h 0.0.0.0
ports:
- "8545:8545"
bridge:
build:
context: .
@djuanit0x
djuanit0x / BitcoinPrice.test.js
Created July 22, 2019 08:00
provable-bitcoin-price
const BitcoinPrice = artifacts.require("BitcoinPrice");
const sleep = ms => {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
};
const getEventLogByTopic = async eventTopic => {
try {
#!/bin/bash
echo "Getting the Bitcoin price using contracts on provable:starter container using docker compose"
docker-compose -f docker-compose.yml up --build
TR=$?
echo exitcode=${TR}
echo "removing................"
docker-compose -f docker-compose.yml rm -f