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
| import bitcoin.main as vitalik # vitalik's bitcoin lib | |
| import bitcoin as bitcoinlib # python-bitcoinlib | |
| import bitcoin.core as bitcoinlibcore | |
| import bitcoin.rpc as bitcoinlibrpc | |
| import bitcoin.transaction as bitcoinlibtransaction | |
| import binascii | |
| import requests | |
| # THIS IS THE MESSAGE TO WRITE ON THE BLOCKCHAIN | |
| msg = "Alberto G. Toribio" |
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
| ## Objective: mine the Bitcoin genesis block | |
| from struct import pack | |
| from hashlib import sha256 | |
| from codecs import decode | |
| from binascii import hexlify | |
| ## Bitcoin uses the SHA256d hash function, which is the SHA256 function | |
| ## run twice (double). | |
| def sha256d(data): |
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 | |
| # Demo of check list using whiptail | |
| whiptail --title "Check list example" --checklist \ | |
| "Choose user's permissions" 20 78 4 \ | |
| "NET_OUTBOUND" "Allow connections to other hosts" ON \ | |
| "NET_INBOUND" "Allow connections from other hosts" OFF \ | |
| "LOCAL_MOUNT" "Allow mounting of local devices" OFF \ | |
| "REMOTE_MOUNT" "Allow mounting of remote devices" OFF |
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
| 0xD35157f340382B50df9CBeaBE320f3a3bb2f86e4 |
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
| Verifying that "gotoalberto.id" is my Blockstack ID. https://onename.com/gotoalberto |
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
| contract Crowdsale { | |
| address public beneficiary; | |
| uint public fundingGoal; uint public amountRaised; uint public deadline; | |
| mapping(address => uint256) public balanceOf; | |
| bool fundingGoalReached = false; | |
| event GoalReached(address beneficiary, uint amountRaised); | |
| event FundTransfer(address backer, uint amount, bool isContribution); | |
| bool crowdsaleClosed = false; | |
| /* at initialization, setup the owner */ |
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
| contract salary { | |
| address owner = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2; | |
| uint256 fee = 1000000; | |
| mapping (uint256 => address) private employees; | |
| function Pay() onlyOwner { | |
| if (ThereAreSufficientFunds) PayAllEmployees(); | |
| } |
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
| val tweet = "this is\ an ex@mple https://twitter.com/joobid/status/732914734308155393 this is an \ex@mple" | |
| val pattern = """(.*?)(https|http)://(.*?)([0-9]+)(\s.*)""".r | |
| tweet match { | |
| case pattern(before, protocol, location, statusid, after) => statusid | |
| //returns "732914734308155393" | |
| } |
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
| test |
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
| sudo update-rc.d myscript defaults 98 02 | |
| sudo update-rc.d myscript remove | |
| The script must be on /etc/init.d with execution permissions. |
NewerOlder