Skip to content

Instantly share code, notes, and snippets.

View aunyks's full-sized avatar
Increasing potential

Gerald Nash aunyks

Increasing potential
View GitHub Profile
@aunyks
aunyks / web3-snitch.html
Created September 11, 2019 14:25
Web3 Snitch detects whether your web3 provider discloses identifying information to dapps without your permission.
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<meta name='viewport' content='width=device-width, initial-scale=1'>
<title>Web3 Snitch</title>
<style>
html,
function setup() {
frameRate(30)
}
const numParticles = 20
const numGradientParts = 20
let particles =
[...(new Array(numParticles)).keys()]
.map(i => {
@aunyks
aunyks / translate-codons.js
Last active March 3, 2020 15:12
This file exports a function that converts a RNA codon into the Amino Acid it encodes. Do your own due diligence to ensure you're processing the right codons.
const isRNANucleotide = n => {
const lowerN = n.toLowerCase()
return (
lowerN === 'a' || // adenine
lowerN === 'u' || // uracil
lowerN === 'c' || // cytosine
lowerN === 'g' // guanine
)
}
@aunyks
aunyks / tune.js
Created June 20, 2020 20:18
A quick Node script for generating a couple MIDI files that make a tune, together.
const {
clip,
scale,
midi,
arp,
getChordsByProgression
} = require('scribbletune')
const progression = getChordsByProgression('d2 major', 'I VI ii V')
contract MyERCToken {
// Create a table so that we can map addresses
// to the balances associated with them
mapping(address => uint256) balances;
// Owner of this contract
address public owner;
function balanceOf(address _owner) constant returns (uint256 balance) {
// Return the balance for the specific address
return balances[_owner];
@aunyks
aunyks / metamine.sol
Created April 30, 2018 01:44
A minable ERC20 token.
pragma solidity ^0.4.0;
// event Mint(address indexed from, uint reward_amount, uint epochCount, bytes32 newChallengeNumber);
// event Transfer(address indexed _from, address indexed _to, uint256 _value);
// event Approval(address indexed _owner, address indexed _spender, uint256 _value);
contract Metamine {
uint256 public constant MAX_TARGET = 2**256 - 1;
uint256 public constant totalSupply = 21000000; // max 21M tokens
contract ERC721 {
// ERC20 compatible functions
function name() constant returns (string name);
function symbol() constant returns (string symbol);
function totalSupply() constant returns (uint256 totalSupply);
function balanceOf(address _owner) constant returns (uint balance);
// Functions that define ownership
function ownerOf(uint256 _tokenId) constant returns (address owner);
function approve(address _to, uint256 _tokenId);
function takeOwnership(uint256 _tokenId);
pragma solidity ^0.4.15;
contract MyERCToken {
// Create a table so that we can map addresses
// to the balances associated with them
mapping(address => uint256) balances;
// Create a table so that we can map
// the addresses of contract owners to
// those who are allowed to utilize the owner's contract
mapping(address => mapping (address => uint256)) allowed;
var request = require('request');
function createTransaction(fromAddress, toAddress, amount, peerUrl){
// Send a post request
request.post(
// ...to the provided url
peerUrl,
{
// ...in JSON
json: {
function createWallet(){
let privateKey = createPrivateKey();
let publicKey = getPublicKey(privateKey);
let address = createAddress(publicKey);
return ({
private: privateKey.toString('hex'),
public: publicKey.toString('hex'),
address: address
});
}