This file contains hidden or 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
""" | |
create file ~/.aws/credentials with content | |
[default] | |
aws_access_key_id = | |
aws_secret_access_key = | |
then install boto3 and run this script | |
""" |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Hello World DApp</title> | |
<link href='https://fonts.googleapis.com/css?family=Open Sans:400,700' rel='stylesheet' type='text/css'> | |
<link href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css' rel='stylesheet' type='text/css'> | |
</head> | |
<body class="container"> | |
<h1>A Simple Hello World Voting Application</h1> | |
<div class="table-responsive"> |
This file contains hidden or 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
In your node console: | |
> contractInstance.totalVotesFor.call('Rama') | |
{ [String: '0'] s: 1, e: 0, c: [ 0 ] } | |
> contractInstance.voteForCandidate('Rama', {from: web3.eth.accounts[0]}) | |
'0xdedc7ae544c3dde74ab5a0b07422c5a51b5240603d31074f5b75c0ebc786bf53' | |
> contractInstance.voteForCandidate('Rama', {from: web3.eth.accounts[0]}) | |
'0x02c054d238038d68b65d55770fabfca592a5cf6590229ab91bbe7cd72da46de9' | |
> contractInstance.voteForCandidate('Rama', {from: web3.eth.accounts[0]}) | |
'0x3da069a09577514f2baaa11bc3015a16edf26aad28dffbcd126bde2e71f2b76f' | |
> contractInstance.totalVotesFor.call('Rama').toLocaleString() |
This file contains hidden or 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
Execute this in your node console: | |
> abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface) | |
> VotingContract = web3.eth.contract(abiDefinition) | |
> byteCode = compiledCode.contracts[':Voting'].bytecode | |
> deployedContract = VotingContract.new(['Rama','Nick','Jose'],{data: byteCode, from: web3.eth.accounts[0], gas: 4700000}) | |
> deployedContract.address | |
'0x0396d2b97871144f75ba9a9c8ae12bf6c019f610' <- Your address will be different | |
> contractInstance = VotingContract.at(deployedContract.address) |
This file contains hidden or 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
In the node console | |
> Web3 = require('web3') | |
> web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); | |
> web3.eth.accounts | |
['0x5c252a0c0475f9711b56ab160a1999729eccce97' | |
'0x353d310bed379b2d1df3b727645e200997016ba3' | |
'0xa3ddc09b5e49d654a43e161cae3f865261cabd23' | |
'0xa8a188c6d97ec8cf905cc1dd1cd318e887249ec5' | |
'0xc0aa5f8b79db71335dacc7cd116f357d7ecd2798' | |
'0xda695959ff85f0581ca924e549567390a0034058' |
This file contains hidden or 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.18; | |
contract Voting { | |
mapping (bytes32 => uint8) public votesReceived; | |
bytes32[] public candidateList; | |
function Voting(bytes32[] candidateNames) public { | |
candidateList = candidateNames; | |
} |
This file contains hidden or 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 | |
sudo add-apt-repository ppa:bitcoin/bitcoin -y | |
sudo apt-get update | |
sudo apt-get install build-essential libtool automake autotools-dev autoconf pkg-config libssl-dev libgmp3-dev libevent-dev bsdmainutils -y | |
sudo apt-get install libboost-all-dev -y | |
sudo apt-get install libdb4.8-dev libdb4.8++-dev -y | |
sudo apt-get install libminiupnpc-dev -y | |
mkdir magnet |
This file contains hidden or 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 | |
#Force file syncronization and lock writes | |
mongo admin --eval "printjson(db.fsyncLock())" | |
MONGODUMP_PATH="/usr/bin/mongodump" | |
MONGO_HOST="prod.example.com" | |
MONGO_PORT="27017" | |
MONGO_DATABASE="dbname" | |
This file contains hidden or 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
{% extends "bsc_base.html" %} | |
{% load i18n l10n user_tags %} | |
<!--<!DOCTYPE html>--> | |
<!--<html lang="en">--> | |
<!--<head>--> | |
<!--<meta charset="UTF-8">--> | |
<!--<title>{% trans "Export data" %}</title>--> | |
{% block title %}{% blocktrans %}Export data{% endblocktrans %}{% endblock %} | |
{% block content %} |
This file contains hidden or 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
/** | |
* 1. install nodejs from https://nodejs.org/en/download/ | |
* 2. run `npm install -g serve-static filehandler serve-index` in terminal | |
* 3. run `node mediaserver.js` | |
*/ | |
var http = require('http'), | |
fs = require('fs'), | |
util = require('util'), | |
url = require('url'), | |
path = require('path'), |