Skip to content

Instantly share code, notes, and snippets.

View jtakalai's full-sized avatar
💭
^_________^

jtakalai

💭
^_________^
View GitHub Profile
@jtakalai
jtakalai / run_mist.sh
Created April 25, 2017 12:41
Run mist (after git clone)
#!/bin/sh
cd interface
meteor &
sleep 3
cd -
electron . --rpc ~/Library/Ethereum/testnet/geth.ipc
@jtakalai
jtakalai / ponzicoin_profits.txt
Created January 29, 2018 11:26
PonziCoin profit calculation
calculation in browser console:
var fyffe = 0, velka = 0, tokenit = 0, p = 1; for (var i = 1; i < 10; i++) { fyffe += p * 100; tokenit += 100; velka = p * tokenit / 4; console.log("Fyffe: " + fyffe + ", tokenit: " + tokenit + ", velka: " + velka + ", profit: " + (fyffe - velka)); p = p * 2; }
console output:
Fyffe: 100, tokenit: 100, velka: 25, profit: 75
Fyffe: 300, tokenit: 200, velka: 100, profit: 200
Fyffe: 700, tokenit: 300, velka: 300, profit: 400
Fyffe: 1500, tokenit: 400, velka: 800, profit: 700
Fyffe: 3100, tokenit: 500, velka: 2000, profit: 1100
Fyffe: 6300, tokenit: 600, velka: 4800, profit: 1500
@jtakalai
jtakalai / startConsole.js
Created April 3, 2018 16:05
Homegrown Ethereum console
// Helper functions for an "ethereum console", similar to geth --attach
var _ = require("lodash")
var Table = require("cli-table")
var BN = require("bignumber.js")
var Web3 = require("web3")
var web3 = new Web3()
web3.setProvider(new web3.providers.HttpProvider('http://localhost:8545'))
@jtakalai
jtakalai / SimpleToken.sol
Created September 17, 2018 12:42
A simple token (not ERC20 compliant)
pragma solidity ^0.4.24;
contract SimpleToken {
string public constant name = "My Simple Token";
string public constant symbol = "TEST";
uint8 public constant decimals = 18; // same as ether
mapping (address => uint256) public balanceOf;
event Transfer(address indexed from, address indexed to, uint tokens);
@jtakalai
jtakalai / UbiToken.sol
Last active September 18, 2018 09:32
ERC20 compatible token with an added feature
pragma solidity ^0.4.24;
// Token standard interface
contract ERC20 {
// Basic token features: book of balances and transfer
uint public totalSupply = 0;
mapping (address => uint256) public balanceOf;
function transfer(address to, uint tokens) public returns (bool success);
// Advanced features: An account can approve another account to spend its funds
@jtakalai
jtakalai / TestToken.sol
Last active September 18, 2018 09:32
Fully ERC20 compliant Ethereum token
pragma solidity ^0.4.24;
// Token standard interface
contract ERC20 {
// Basic token features: book of balances and transfer
uint public totalSupply = 0;
mapping (address => uint256) public balanceOf;
function transfer(address to, uint tokens) public returns (bool success);
// Advanced features: An account can approve another account to spend its funds
@jtakalai
jtakalai / Puzzle.sol
Last active November 8, 2018 08:30
What does this contract do? Can you spot a bug?
pragma solidity ^0.4.0;
contract Puzzle {
address _a;
address _b;
constructor(address a, address b) public {
_a = a;
_b = b;
}
@jtakalai
jtakalai / Testing.sol
Created November 19, 2018 08:25
Testing "continue" keyword to replicate whas was reported fixed in https://solidity.readthedocs.io/en/latest/050-breaking-changes.html
pragma solidity ^0.4.22;
/** @dev herp derp */
contract Testing {
event Show(bytes s);
bytes32[] derp;
function continueTest() public {
derp.push(0x123);
derp.push(0x0);

Keybase proof

I hereby claim:

  • I am jtakalai on github.
  • I am jtakalai (https://keybase.io/jtakalai) on keybase.
  • I have a public key ASCYwPWgIZ_Gw3zmcKlAwRsXrr_rfp5AqI55eziLhyghLAo

To claim this, I am signing this object:

@jtakalai
jtakalai / log.txt
Created November 5, 2019 10:02
Complex power tower
> c=new C(-0.8); x=c; res=[]; for (let i = 0; i < 10; i++) res.push(x = x.pow(c)); res
[ { re: -0.967131781178879, im: -0.7026623692120304 },
{ re: -0.3691153675094393, im: 0.7844100843322339 },
{ re: -0.042251892773906244, im: -1.120235261735242 },
{ re: 0.2557231881056781, im: 0.8760941991244778 },
{ re: 0.5543917466943977, im: -0.9220211474369996 },
{ re: 0.6410070262045503, im: 0.6918834867768658 },
{ re: 0.8285847445893876, im: -0.6415296186745002 },
{ re: 0.8325254334492322, im: 0.4845217029269798 },
{ re: 0.940151752960039, im: -0.4217163364065653 },