Skip to content

Instantly share code, notes, and snippets.

View omgbbqhaxx's full-sized avatar
🪐
Universal

Yasin Aktimur omgbbqhaxx

🪐
Universal
View GitHub Profile
@omgbbqhaxx
omgbbqhaxx / SwordNFT.sol
Created August 8, 2023 17:58 — forked from Chmarusso/SwordNFT.sol
Learn how to create truly immutable smart contracts (Ethereum / EVM) that can hold all metadata and SVG images on-chain
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.7;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
library Base64 {
string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000"
@omgbbqhaxx
omgbbqhaxx / minePYTHON36.py
Created October 22, 2019 14:02 — forked from turunut/minePYTHON36.py
Example of how a Bitcoin block is mined by finding a successful nonce
import hashlib, struct, codecs
ver = 2
prev_block = "000000000000000117c80378b8da0e33559b5997f2ad55e2f7d18ec1975b9717"
mrkl_root = "871714dcbae6c8193a2bb9b2a69fe1c0440399f38d94b3a0f1b447275a29978a"
time_ = 0x53058b35 # 2014-02-20 04:57:25
bits = 0x19015f53
# https://en.bitcoin.it/wiki/Difficulty
exp = bits >> 24
@omgbbqhaxx
omgbbqhaxx / block.py
Created October 22, 2019 13:41 — forked from ChristopherJohnston/block.py
Example Blockchain hash calculations using Python
from hashlib import sha256
import time
import struct
import binascii
import datetime
VERSION = 1
def hexify(value, type):
return binascii.hexlify(struct.Struct(type).pack(value))
@omgbbqhaxx
omgbbqhaxx / bintree.py
Created July 29, 2019 16:00 — forked from samidhtalsania/bintree.py
Binary tree in Python
class Node():
def __init__(self,key):
self.key = key
self.left = None
self.right = None
self.parent = None
class Tree():
@omgbbqhaxx
omgbbqhaxx / gist:7aba5c4d10259735ecc7d5bfc04ffdb3
Created June 21, 2019 12:57 — forked from omarbaruzzo/gist:a86a65d890ed823013315ea2d3727c2d
GenesisCalculator - code to be included in chainparams.cpp to calculate the genesis block, nnonce, merkle root etc.
#include "arith_uint256.h"//Mod.
//----------------------------------------------------------------------------------------------------------
//Mod.
/*
// calcolo del Blocco Genesi
// Resettiamo il valore del blocco
consensus.hashGenesisBlock = uint256S("0x");
std::cout << std::string("Iniziamo a calcolare il blocco:\n");
if (true && (genesis.GetHash() != consensus.hashGenesisBlock)) {
@omgbbqhaxx
omgbbqhaxx / gist:7eacfa2f1b494cde58aa7978cd14980c
Created June 13, 2019 17:17 — forked from matthieu/gist:b07c5ba27bc99188a15f
Create and send a Bitcoin transaction using the BlockCypher Transaction API
# In this example we're sending some test bitcoins from an address we control to a brand new test
# address. We'll be sending the coins using the following address, public and private keys (please
# don't abuse).
# address : mtWg6ccLiZWw2Et7E5UqmHsYgrAi5wqiov
# public : 03bb318b00de944086fad67ab78a832eb1bf26916053ecd3b14a3f48f9fbe0821f
# private : 1af97b1f428ac89b7d35323ea7a68aba8cad178a04eddbbf591f65671bae48a2
# 1. generate a one-shot dummy address we're going to send money to
$ curl -X POST http://api.blockcypher.com/v1/btc/test3/addrs
{
@omgbbqhaxx
omgbbqhaxx / ethereum-backend.js
Created March 16, 2019 18:48 — forked from sulejirl/ethereum-backend.js
Ethereum: Sending Transaction via NodeJS Backend Tutorial
const web3 = require('web3');
const express = require('express');
const Tx = require('ethereumjs-tx');
const app = express();
//Infura HttpProvider Endpoint
web3js = new web3(new web3.providers.HttpProvider("https://rinkeby.infura.io/YOUR_API_KEY"));
app.get('/sendtx',function(req,res){
@omgbbqhaxx
omgbbqhaxx / README.sh
Created November 10, 2018 20:25 — forked from tdgunes/README.sh
Installing Spatialite for Django on Ubuntu/Debian
#On Debian 7.0
#Install build essentials
sudo apt-get install build-essential
#Install dependencies
sudo apt-get install binutils libproj-dev gdal-bin
sudo apt-get install libgeos-dev
sudo apt-get install libexpat1 libexpat1-dev
sudo apt-get install pkg-config
@omgbbqhaxx
omgbbqhaxx / CoinFlipOracle.sol
Created May 20, 2018 12:11 — forked from AlwaysBCoding/CoinFlipOracle.sol
Ethereum Ðapp Development - Video 12 | Oracles and Oraclize
pragma solidity ^0.4.0;//please import oraclizeAPI_pre0.4.sol when solidity < 0.4.0
contract OraclizeI {
address public cbAddress;
function query(uint _timestamp, string _datasource, string _arg) payable returns (bytes32 _id);
function query_withGasLimit(uint _timestamp, string _datasource, string _arg, uint _gaslimit) payable returns (bytes32 _id);
function query2(uint _timestamp, string _datasource, string _arg1, string _arg2) payable returns (bytes32 _id);
function query2_withGasLimit(uint _timestamp, string _datasource, string _arg1, string _arg2, uint _gaslimit) payable returns (bytes32 _id);
function getPrice(string _datasource) returns (uint _dsprice);
function getPrice(string _datasource, uint gaslimit) returns (uint _dsprice);
@omgbbqhaxx
omgbbqhaxx / bitcoin_block_difficulty_analysis.py
Created April 17, 2018 23:55 — forked from jackschultz/bitcoin_block_difficulty_analysis.py
Showing of Bitcoin's Proof of Work difficulty is calculated and changed.
import datetime
###################################################################
#
# Showing the way bits, difficulty, target, and hash work together.
#
###################################################################
print "Calculating target from bits, verifying the block's hash is valid, and verify the calculated difficulty."