This file contains 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
# We multiply all modulo of the monkeys and use it to keep | |
# the number small | |
modulo = 23 * 19 * 13 * 17 | |
monkeys = [ | |
{ | |
'items': [79, 98], | |
'operation': lambda x: (x * 19)%modulo, | |
'test': lambda x: x % 23 == 0, | |
'throw': lambda arr, test, val: monkeys[2 if test else 3]['items'].append(val), |
This file contains 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
from functools import reduce | |
import numpy as np | |
def product(arr): | |
return reduce(lambda a,b: a*b, arr, 1) | |
class Activation(): | |
def forward(self, inputs): | |
raise RuntimeException('Unimplemented abstract function Activation::forward!') |
This file contains 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
sudo apt install libx11-dev | |
sudo apt install libgl1-mesa-dev | |
sudo apt install build-essential libxmu-dev libxi-dev libgl-dev libosmesa-dev | |
sudo apt install x11proto-randr-dev | |
sudo apt-get install libglu1-mesa-dev freeglut3-dev mesa-common-dev |
This file contains 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 canvas = document.querySelector('canvas#screen'); | |
canvas.width = innerWidth; | |
canvas.height = innerHeight; | |
const ctx = canvas.getContext('2d'); | |
const RED = 0, GREEN = 1; | |
const COLORS = ['red', 'green']; | |
// const COLORS = ['white', 'black']; | |
class Cell { |
This file contains 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 express = require('express'); | |
const app = express(); | |
const port = process.env.PORT || 5000; | |
const server = app.listen(port); | |
app.use(express.static('public')); | |
console.log('Socket server is running at localhost:' + port); | |
let socket = require('socket.io'); |
This file contains 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
local v1 = Vector:new(3, 7) | |
local v2 = Vector:new(4, 9) | |
print("Vector 1: x = " .. v1.x .. ", y = " .. v1.y); | |
print("Vector 2: x = " .. v2.x .. ", y = " .. v2.y); | |
print(v1.get_x); | |
print(v1.get_x()); | |
--print("Method Vector 1 get_x: " .. Vector:get_x(v1)); |
This file contains 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
Show hidden characters
{ | |
"shell_cmd": "sfml \"${file_path}\"", | |
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$", | |
"working_dir": "${file_path}", | |
"selector": "source.c++", | |
"variants": [ | |
{ | |
"name": "Run", | |
"shell_cmd": "sfml \"${file_path}\" run" | |
} |
This file contains 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 isClose(a,b,debug=false){ | |
let differ=0, aa=a.split(''), bb=b.split(''); | |
for(const letter of 'abcdefghijklmnopqrstuvwxyz'){ | |
let aaa=aa.includes(letter), bbb=bb.includes(letter); | |
if(!((aaa && bbb) || (!aaa && !bbb))) { | |
differ++; | |
} | |
} | |
if(debug) console.log(differ); | |
return differ <= 2; |
This file contains 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
<html lang="en"> | |
<head> | |
<!-- <script id="facebook-jssdk" src="https://connect.facebook.net/en_US/sdk.js" async defer></script> | |
<script src="https://apis.google.com/js/platform.js" async defer></script> | |
<style type="text/css"> | |
.icon { | |
width: 36px; | |
height: 36px; | |
background-repeat: no-repeat; | |
background-position: center; |
This file contains 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
class Promise { | |
constructor(action){ | |
this.status = 'pending'; | |
this.value = this.error = undefined; | |
action((value=>{ | |
this.status = 'resolved'; | |
this.value = value; | |
}).bind(this),(error=>{ | |
this.status = 'rejected'; |
NewerOlder