Skip to content

Instantly share code, notes, and snippets.

Avatar
Working from boat

Davide Gessa dakk

Working from boat
View GitHub Profile
View qiskit_example.ml
open Qiskit
(* Create the circuit *)
let qc = quantum_circuit 2 2
|> h 0
|> id 1
|> barrier
|> cx 0 1
|> barrier
|> measure 0 0
@dakk
dakk / yallo_medium_1_deploy.yallo
Last active Jul 7, 2020
yallo_medium_1_deploy.yallo
View yallo_medium_1_deploy.yallo
import "Token.yallo";
contract deployAToken {
field tokenAddress: address;
entry deployToken() {
let (a: address, op: operation) = Tezos.createContract (Token(Tezos.selfAddress(), 100, "ourToken"), None, 0);
this.tokenAddress = a;
[op]
}
@dakk
dakk / yallo_medium_1_using.yallo
Created Jul 7, 2020
yallo_medium_1_using.yallo
View yallo_medium_1_using.yallo
import "IToken.yallo";
const tokenContractAddress: address = @KT1ThEdxfUcWUwqsdergy3QnbCWGHSUHeHJq;
contract usingAToken {
field bal: nat;
entry checkBalance(a: address) {
[IToken.of(tokenContractAddress).getBalance(a, this.checkBalanceCallback)]
}
@dakk
dakk / yallo_medium_1_contract.yallo
Created Jul 7, 2020
yallo_medium_1_contract.yallo
View yallo_medium_1_contract.yallo
contract Token implements IToken {
field balances: (address, nat) big_map;
field totalSupply: nat;
field symbol: string;
constructor (owner: address, supply: nat, symbol: string) {
this.balances = [ { owner: supply } ];
this.totalSupply = supply;
this.symbol = symbol;
}
@dakk
dakk / yallo_medium_1_interface.yallo
Created Jul 7, 2020
yallo_medium_1_interface.yallo
View yallo_medium_1_interface.yallo
interface IToken {
entry transfer(from: address, to: address, val: nat);
view getBalance(ad: address): nat;
}
@dakk
dakk / squash-commits.md
Created May 14, 2019 — forked from longtimeago/squash-commits.md
How to squash commits in a GitHub pull request
View squash-commits.md

How to squash commits in a GitHub pull request

o you've contributed some code to an open source project, say, Rails. And they'd like you to squash all of the commits in your pull request. But you're not a git wizard; how do you make this happen?

Normally, you'd do something like this. I'm assuming upstream is a git remote that is pointing at the official project repository, and that your changes are in your 'omgpull' branch:

@dakk
dakk / liskcmdms.sh
Created Apr 10, 2019
lisk-commander: create and sign a multisig transaction
View liskcmdms.sh
# Install lisk-commander
$ sudo npm install --global --production lisk-commander
# Transaction creation
$ lisk transaction:create -t transfer 100 ADDRESSL
? Please enter your secret passphrase: [hidden]
? Please re-enter your secret passphrase: [hidden]
{"amount":"10000000000","recipientId":"XXXL","senderPublicKey":"XX","timestamp":123,"type":0,"fee":"10000000","asset":{},"signature":"XX","id":"123"}
# Broadcast the multisig tx
@dakk
dakk / tezos-baking-howto.md
Last active Sep 18, 2021
tezos-baking-howto.md
View tezos-baking-howto.md

Tezos baking howto

This howto is valid for Betanet on Ubuntu or Debian

Setup

Prereq

You have to install some dependencies. In debian / ubuntu run:

@dakk
dakk / address.js
Last active Mar 26, 2018
Mastering Bitcoin - Chapter 4
View address.js
// First install bitcoinjs-lib and bip39 in the current working directory
// npm install bitcoinjs-lib bip39
const bitcoin = require ('bitcoinjs-lib');
const bip39 = require ('bip39');
/// Generate a random keypair and display private and public key and the address (compressed by default)
let keypair = bitcoin.ECPair.makeRandom ();
console.log ('Address:', keypair.getAddress());
@dakk
dakk / sailaway_on_linux.bash
Last active Jan 15, 2018
How to play SailAway simulator on Linux
View sailaway_on_linux.bash
# For those attempting to install and use it on Linux, this is a quick howto (not really a bash script):
# 1. Download and install Steam with wine
# 2. Start steam and install sailaway
wine Steam.exe
# 3. Now wine will automatically use the wrong version of directx (d3d11); open winecfg, go to libraries, in
# "New override library" search for d3d11 and click "Add". Then click in d3d11 in "Existing override" and click "Edit"
# then switch the combo to "Disable"; press on "Apply" and close winecfg