Skip to content

Instantly share code, notes, and snippets.

View davidawad's full-sized avatar
🇪🇬
البحث عن الحقيقة

David Awad davidawad

🇪🇬
البحث عن الحقيقة
View GitHub Profile
@davidawad
davidawad / unlike all your tweets.js
Created March 27, 2024 00:09
you can run this from the js console on twitter while looking at your likes page to clear them all out. nice and easy
function unlikeAndScroll() {
Array.from(document.querySelectorAll("div[aria-label$='Liked']")).forEach(button => button.click());
console.log('Unliked all visible tweets. Scrolling down...');
// Scroll to the bottom of the page
window.scrollTo(0, document.body.scrollHeight);
// Wait for more tweets to load and then run again
setTimeout(unlikeAndScroll, 3000); // Adjust the time as needed
}
@davidawad
davidawad / chromeConsole.js
Created April 13, 2023 15:33
setup gmail protocol handler in chrome
navigator.registerProtocolHandler("mailto",
"https://mail.google.com/mail/u/1/?extsrc=mailto&url=%s",
"Gmail");
@davidawad
davidawad / namegen.py
Created April 14, 2022 03:31
python script port of the docker name generator
import random
# note, run with python 3 for utf 8 chars.
adjectives = [
"admiring",
"adoring",
"affectionate",
"agitated",
"amazing",

Running Corda 5 with Local Kubernetes : Speaker Notes

Installing everything you'll need for this workshop

You'll need a few things:

  • corda cli
  • cordapp builder
  • java 11
  • docker desktop or another kubernetes cluster running tool (minukube, etc.)
progressTracker.setCurrentStep(FINALISATION);
// We notarise the transaction and get it recorded in the vault of
// the participants of all the transaction's states.
SignedTransaction notarisedTx1 = subFlow(new FinalityFlow(fullySignedTx, singleton(counterpartySession), FINALISATION.childProgressTracker()));
// We can also choose to send it to additional parties who aren't one
// of the state's participants.
List<FlowSession> partySessions = Arrays.asList(counterpartySession, initiateFlow(regulator));
SignedTransaction notarisedTx2 = subFlow(new FinalityFlow(fullySignedTx, partySessions, FINALISATION.childProgressTracker()));
progressTracker.setCurrentStep(SIGS_GATHERING);
// The list of parties who need to sign a transaction is dictated
// by the transaction's commands. Once we've signed a transaction
// ourselves, we can automatically gather the signatures of the
// other required signers using ``CollectSignaturesFlow``.
// The responder flow will need to call ``SignTransactionFlow``.
SignedTransaction fullySignedTx = subFlow(new CollectSignaturesFlow(twiceSignedTx, emptySet(), SIGS_GATHERING.childProgressTracker()));
progressTracker.setCurrentStep(VERIFYING_SIGS);
progressTracker.setCurrentStep(TX_VERIFICATION);
// Verifying a transaction will also verify every transaction in
// the transaction's dependency chain, which will require
// transaction data access on counterparty's node. The
// ``SendTransactionFlow`` can be used to automate the sending and
// data vending process. The ``SendTransactionFlow`` will listen
// for data request until the transaction is resolved and verified
// on the other side:
subFlow(new SendTransactionFlow(counterpartySession, twiceSignedTx));
progressTracker.setCurrentStep(TX_SIGNING);
// We finalise the transaction by signing it,
// converting it into a ``SignedTransaction``.
SignedTransaction onceSignedTx = getServiceHub().signInitialTransaction(txBuilder);
// We can also sign the transaction using a different public key:
PartyAndCertificate otherIdentity = getServiceHub().getKeyManagementService().freshKeyAndCert(getOurIdentityAndCert(), false);
SignedTransaction onceSignedTx2 = getServiceHub().signInitialTransaction(txBuilder, otherIdentity.getOwningKey());
progressTracker.setCurrentStep(TX_BUILDING);
// If our transaction has input states or a time-window, we must instantiate it with a
// notary.
TransactionBuilder txBuilder = new TransactionBuilder(specificNotary);
// Otherwise, we can choose to instantiate it without one:
TransactionBuilder txBuilderNoNotary = new TransactionBuilder();
// We add items to the transaction builder using ``TransactionBuilder.withItems``:
progressTracker.setCurrentStep(OTHER_TX_COMPONENTS);
// Reference input states are constructed from StateAndRefs.
ReferencedStateAndRef referenceState = ourStateAndRef.referenced();
// Output states are constructed from scratch.
DummyState ourOutputState = new DummyState();
// Or as copies of other states with some properties changed.
DummyState ourOtherOutputState = ourOutputState.copy(77);