Skip to content

Instantly share code, notes, and snippets.

@volkanozcan2
volkanozcan2 / index.html
Created Aug 21, 2018
to ivan.popelyshev
View index.html
<div id="myContainer"></div>
@volkanozcan2
volkanozcan2 / src.js
Last active May 7, 2018
pixi:template
View src.js
$(document).ready(onReady)
window.onresize = resize;
let opts = {
transparent: false,
backgroundColor: 0x49DCB1,
resolution: 1,
antialias: 0,
autoResize: true,
forceCanvas: false,
clearBeforeRender: true
@volkanozcan2
volkanozcan2 / primeImage.py
Created Jan 27, 2018
image from prime numbers
View primeImage.py
import numpy as np
import time
import primesieve
from PIL import Image
# t is time in seconds
#fps is videos frame rate
t=30
fps=30
@volkanozcan2
volkanozcan2 / collatz.js
Last active Dec 17, 2017
Collatz conjecture
View collatz.js
function Collatz(n) {
console.log(n);
if (n == 1) {
return false;
}
if (n % 2 == 0) {
Collatz(n / 2);
} else {
Collatz(3 * n + 1);
}
View rnd.js
sıfat = ["bir", "çok", "daha", "var", "her", "iki", "büyük", "iyi", "yeni", "başka", "orta", "bütün", "böyle", "aynı", "ilk", "ön", "önemli", "alt", "ğer", "doğru", "tüm", "az", "bazı", "küçük", "fazla", "güzel", "biraz", "tek", "birlikte", "genç", "uzun", "hiçbir", "üç", "tam", "ilgili", "eski", "yakın", "özel", "pek", "gerek", "yüksek", "geri", "farklı", "gelen", "birkaç", "açık", "tabi", "ikinci", "geçen", "kısa", "kolay", "uzak", "uygun", "kötü", "mümkün", "on", "üst", "sürekli", "çeşitli", "belli", "ayrı", "yalnız", "yavaş", "gerekli", "yanlış", "art", "doğal", "ekonomik", "genel", "dört", "beş", "geniş", "sağ", "sıcak", "ağır", "eş", "sol", "birinci", "hoş", "ünlü", "beyaz", "öte", "hızlı", "çoğu", "kimi", "ince", "kaç", "herhangi bir", "değişik", "asıl", "güçlü", "uç", "sevgili", "cid", "derin", "soğuk", "canlı", "yaşlı", "boş", "başarılı", "birer", "her şey", "ait", "normal", "kırmızı", "hazır", "yarı", "yeterli", "karanlık", "sosyal", "rahat", "gizli", "benzer", "yeşil", "üçüncü", "ilginç", "uluslara
@volkanozcan2
volkanozcan2 / btc Wallet.ipynb
Last active Nov 20, 2017
Python code to generate public private keys for btc addresses .
View btc Wallet.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View utils.js
Point=PIXI.ObservablePoint;
Object.assign(Number.prototype, {
map(in_min, in_max, out_min, out_max) {
return (this - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
},
constrain(low, high) {
return Math.max(Math.min(this, high), low);
}
});
View app.js
// Copyright (c) 2011 Alexei Kourbatov, www.JavaScripter.net
// function leastFactor(n) returns:
// * the smallest prime that divides n
// * NaN if n is NaN or Infinity
// * 0 if n is 0
// * 1 if n=1, n=-1, or n is not an integer
leastFactor = function(n) {
if (isNaN(n) || !isFinite(n)) return NaN;
@volkanozcan2
volkanozcan2 / app.js
Created Sep 6, 2017
createBinaryHuman
View app.js
let fs = require("fs");
let wr = fs.createWriteStream("./humans");
let stream = require("stream");
Number.prototype.toHex = function(digits = 2) {
let l = this.valueOf().toString(16);
if (digits - l.length <= 0) {
return l
} else {
return Array((digits - l.length) + 1).join("0") + l
}
View app.js
//from https://stackoverflow.com/a/18650828/1342927
Object.defineProperty(Number.prototype, "Size", {
get: function(b = 3) {
if (0 == this.valueOf()) return "0 Bytes";
var c = 1024,
d = b || 2,
e = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"],
f = Math.floor(Math.log(this.valueOf()) / Math.log(c));
return parseFloat((this.valueOf() / Math.pow(c, f)).toFixed(d)) + " " + e[f]
}