This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function simulate(initial_capital) { | |
let optimalIncome = -Infinity | |
let optimalConfiguration = null | |
// greedy simulator (suboptimal) | |
for (let miner of miners) { | |
for (let n = 0; ; ++n) { | |
let technologyCost = miner.cost * n | |
if (technologyCost > initialCapital) { | |
break |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const EventEmitter = require('events') | |
class MarketWatcher extends EventEmitter { | |
constructor (name) { | |
super() | |
this.name = name | |
let i = 0 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const K = 128 | |
const GENESIS_DISTRIBUTION_SC = {} | |
const GENESIS_DISTRIBUTION_MC = {} | |
const GENESIS_TRUST_KEY = 'some key' | |
class BalanceKeeper { | |
constructor(initialBalances = {}) { | |
this.balances = initialBalances | |
} | |
getBalance(account) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ορισμός Gödel αριθμών. | |
Έστω μία συμβολοσειρά s στο {0, 1}*. Τότε ο αριθμός Godel g(s) είναι: | |
(α) g(s) = 1, αν s = ε | |
(β) g(s) = 10f + x + 1, αν s = xp όπου x στο {0, 1} και p στο {0, 1}^* και f είναι ο αριμός Godel της p | |
Ορίζω G = {x: ∃s ∊ {0, 1}*: x = g(s)}. | |
Έστω S = {x | δυαδικός με άπειρο μέγεθος} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function delay(interval) { | |
return new Promise((resolve, reject) => { | |
setTimeout(resolve, interval) | |
}) | |
} | |
async function watch(expression, interval=200) { | |
while (true) { | |
let value = expression() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dionyziz@erdos ~/workspace/jsmess/third_party/emscripten-fastcomp/build (incoming) % ../configure --enable-optimized --disable-assertions --enable-targets=host,js | |
################################################################################ | |
################################################################################ | |
The LLVM project no longer supports building with configure & make. | |
Please migrate to the CMake-based build system. | |
For more information see: http://llvm.org/docs/CMake.html | |
################################################################################ | |
################################################################################ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cstdio> | |
#include <cassert> | |
#include <vector> | |
#include <cmath> | |
#include <iostream> | |
const double R_MAX = 0.0001; | |
using namespace std; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const mysql = require('mysql') | |
const connection = mysql.createConnection({ | |
host: 'localhost', | |
user: 'root', | |
password: '', | |
database: 'fatcat' | |
}) | |
connection.connect((err) => { | |
if (err) { | |
console.log('Error connecting to MySQL database: ' + err) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pygame | |
from datetime import datetime | |
import math | |
BLACK = (0, 0, 0) | |
WHITE = (255, 255, 255) | |
RED = (255, 0, 0) | |
DIGITAL_H = 100 # height of digital clock | |
W = 700 # screen width |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NUM_COUNT = 4 | |
with open('data.txt') as f: | |
lines = f.read().strip().split('\n') | |
N = len(lines) | |
data = [] | |
for line in lines: | |
line = line.split(' ') | |
numbers = map(int, line) | |
data.append(numbers) |