Skip to content

Instantly share code, notes, and snippets.

View gotoalberto-zz's full-sized avatar

Alberto Gomez Toribio gotoalberto-zz

View GitHub Profile
@gotoalberto-zz
gotoalberto-zz / op_return.py
Last active June 7, 2021 06:52
OP_RETURN on Bitcoin Regtest
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"
@gotoalberto-zz
gotoalberto-zz / miner.py
Created November 22, 2018 09:39
miner.py
## 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):
#!/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
@gotoalberto-zz
gotoalberto-zz / gist:bd76350bad3b275d3cc59202dceb1bf9
Created September 17, 2017 10:40
0xD35157f340382B50df9CBeaBE320f3a3bb2f86e4
0xD35157f340382B50df9CBeaBE320f3a3bb2f86e4
@gotoalberto-zz
gotoalberto-zz / gist:dfac7417ed180673d3486eba07ced0f1
Created March 21, 2017 23:26
Verifying that "gotoalberto.id" is my Blockstack ID. https://onename.com/gotoalberto
Verifying that "gotoalberto.id" is my Blockstack ID. https://onename.com/gotoalberto
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 */
contract salary {
address owner = 0x72ba7d8e73fe8eb666ea66babc8116a41bfb10e2;
uint256 fee = 1000000;
mapping (uint256 => address) private employees;
function Pay() onlyOwner {
if (ThereAreSufficientFunds) PayAllEmployees();
}
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"
}
@gotoalberto-zz
gotoalberto-zz / gist:680dd955fd7219002118
Created October 27, 2014 16:06
Add and remove from startup ubuntu
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.