Skip to content

Instantly share code, notes, and snippets.

View Ayms's full-sized avatar

Aymeric Vitte Ayms

View GitHub Profile
@Ayms
Ayms / gist:2995641
Created June 26, 2012 12:53
|wrap| suggestion in strict mode

|wrap| suggestion (was |with|'s redesign attempt, but it seems nobody want to hear again about |with| in strict mode) in strict mode which is supposed to address at least 4 subjects mentionned below.

The concern here is more to address the subject of binding variables to properties than using properties of an object passed as an argument to |wrap| (then it is somewhere the contrary of what is doing a usual |with|). Then the suggestion here is to pass nothing to |wrap| and implicitely declare in the wrap statement the |this| binding

Issue (one of...) : |wrap| is not a reserved keyword

##Suggestion

@Ayms
Ayms / gist:6451926
Last active July 30, 2023 13:06
WebCrypto code example - Upload a file, encrypt it, calculate the hash and store the results using indexedDB

Code example using WebCrypto, File API, indexedDB, createObjectURL and Workers.

<input type="file" onsubmit="process_upload">
var workerjs=' \
  onmessage=function(evt) { \
		var encrypt=crypto.workersubtle.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},evt.data[0]); \
		var buffer=evt.data[1]; \
@Ayms
Ayms / gist:077b114a27450f773939
Last active August 12, 2024 14:30
Monitoring and blocking the bittorrent monitoring spies

##Target

Protecting the privacy of the bittorrent users and protecting them from the monitoring spies making their activity much less visible by changing the way they connect to a torrent and setting a method to establish dynamic blocklists and maintain them.

##Abstract

Previous research has focused mainly on discovering monitors using trackers, this study focuses on tracking and blocking the monitors using the bittorrent peers and content discovery system only (called the DHT).

The global result is that the spies are organized to monitor automatically whatever exists in the bittorrent network, they are easy to find but difficult to follow since they might change their IP addresses and are polluting the DHT.

@Ayms
Ayms / crypto.md
Last active March 24, 2023 17:14
Bitcoin, Ethereum, smart contracts, lightning, sidechains, Defi, DApps, NFTs, DEX, DAO explained - Centralization vs Decentralization

Note: this article is for some parts a bit technical, but you can skip those parts and just read the plain text, which is supposed to be understandable by anybody

Note2: for Ethereum some sections are copy/paste from articles and Ethereum official documentation

The intent here is to explain what is really behind the crypto currencies technologies which is never really explained and people don't know unless they have some (kind of deep) technical knowledge

I often react when people are talking about crypto currencies as "virtual" money, this is not virtual money but electronic money, there is a work behind this and this is no more virtual than a bank bill

Now, when it comes to discuss sidechains and smart contracts, things can really become virtual, let's see how it works on bictoin and ethereum, for comprehension purposes we have to go a little far in technical details while using some simplification language as some experts might notice and start with easy things, this is not a vulgarization arti

@Ayms
Ayms / nft.md
Last active March 19, 2023 19:24
A Bitcoin NFT System

A Bitcoin NFT system

Note: this proposal needs to be slighltly modified since the storage limit for OP_RETURN is 80B and does not work for all cases, but the principles will remain the same and other storage solutions exist, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-February/021398.html

Then for now some transactions mentionned in that proposal are not standard (ie not relayed by the nodes) but valid (ie a miner can include them into a block)

So, after discussion with the bictoin community, see Allow several OP_RETURN in one tx and no limited size

In case this change, which looks to be admitted by the majority, is trivial and not even a soft fork, is not implemented then please see the different workarounds at the end of this proposal

@Ayms
Ayms / wrap.md
Last active March 7, 2023 16:14
A Universal Coin Swap system based on Bitcoin

A Universal Coin Swap system based on Bitcoin

Note: this proposal needs to be slighltly modified since the storage limit for OP_RETURN is 80B and does not work for all cases, but the principles will remain the same and other storage solutions exist, see https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2023-February/021398.html

Then for now some transactions mentionned in that proposal are not standard (ie not relayed by the nodes) but valid (ie a miner can include them into a block)

So, after discussion with the bictoin community, see Allow several OP_RETURN in one tx and no limited size

In case this change, which looks to be admitted by the majority, is trivial and not even a soft fork, is not implemented then please see the different workarounds at the end of this proposal