Skip to content

Instantly share code, notes, and snippets.

View brakmic's full-sized avatar
🏠

Harris Brakmić brakmic

🏠
View GitHub Profile
@brakmic
brakmic / bitcoin_transaction_input_simplified.cpp
Created October 8, 2017 17:25
Bitcoin Transaction Input (simplified)
class TransactionInput {
public:
uint256 HashKey;
uint32_t IndexNumber;
uint32_t SignatureScriptLength;
uint256 ResponseScript;
uint32_t InputSequenceNumber;
};
@brakmic
brakmic / bitcoin_transaction_simplified.cpp
Created October 8, 2017 16:53
Bitcoin Transaction (simplified)
class Transaction {
public:
const int32_t Version;
const uint32_t NumberOfInputs;
const vector<TransactionInput> CollectionOfInputs;
const uint32_t NumberOfOutputs;
const vector<TransactionOutput> CollectionOfOutputs;
const uint32_t LockTimestamp;
};
@brakmic
brakmic / bitcoin_blockheader_simplified.cpp
Created October 3, 2017 11:10
Bitcoin Block Header (simplified)
class BlockHeader {
public:
int32_t Version;
uint256 PreviousBlockHash;
uint256 MerkleRootHash;
uint32_t Timestamp;
uint32_t TargetToBeSolved;
uint32_t NonceForProofOfWork;
};
@brakmic
brakmic / bitcoin_block_simplified.cpp
Last active October 3, 2017 11:08
Bitcoin Block (simplified)
class Block {
public:
BlockHeader Header;
vector Transactions;
};
@brakmic
brakmic / json_stringify_circular_for_angular.js
Last active July 31, 2017 12:22
AngularJS-Module: Stringify JSON Objects with circular dependencies
(function () {
/* converted by @brakmic */
/* original code: https://github.com/isaacs/json-stringify-safe */
/* usage example:
*
*angular.module("myModule", ['jsonStringify'])
* .controller("MainCtrl", ['StringifyJsonService', MainCtrl]);
*
0x094f3723c13E9ee24de4AEb5b358FdD94D34315C
@brakmic
brakmic / WannaLaugh.ps1
Created May 12, 2017 22:57
stop WannaCry from spreading
# open powershell and execute this file
# let the window open
# if the script won't start because of local execution policy restrictions you can use "Set-Execution-Policy Bypass"
$createdNew = $False;
$mutex = New-Object -TypeName System.Threading.Mutex($true, "MsWinZonesCacheCounterMutexA", [ref]$createdNew);
@brakmic
brakmic / alternative_customer_state_selection.ts
Created April 11, 2017 11:55
alternative way of selecting customer state
this.store.select(appState => appState.customerState).subscribe(subState => {
const customerInstance = subState.customer; // not an observable but a concrete instance
});
@brakmic
brakmic / get_observable.ts
Created April 11, 2017 11:50
get customer observable
private getCustomerObservable() {
this.customer = getCustomer(this.store);
}
@brakmic
brakmic / dispatch_action.ts
Created April 11, 2017 11:21
dispatching an action
this.customerTable.on('select', (e: Event, dt: DataTables.DataTable,
type: string, indexes: number[]) => {
let row: INWCustomer = dt.rows(indexes[0]).data()['0'];
const customer = this.toLocalCustomer(row);
this.store.dispatch(this.customerActions.customerSelected(customer));
});