Skip to content

Instantly share code, notes, and snippets.

@volkanozcan2
volkanozcan2 / app.js
Last active January 9, 2018 10:30
prime
// 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 / primeImage.py
Created January 27, 2018 22:06
image from prime numbers
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 / Welcome file.md
Created November 24, 2018 14:24
Welcome file

demo

import math
import numpy as np
from scipy import constants as cons

$$\large t_{' }=\frac{t^{}}{\sqrt{1-\frac{V^2}{c^2}}}$$

var app = express();
app.io = require('socket.io')();
var routes = require('./routes/index')(app.io);
app.use('/', routes);
@volkanozcan2
volkanozcan2 / readable.js
Last active August 10, 2019 14:54
node:readable stream
const { Readable } = require("stream");
const { firstName, lastName } = require("faker/locale/en").name;
const { createWriteStream } = require("fs");
class randomName extends Readable {
constructor(options) {
super(options);
this.count = 1e3;
}
_read() {
@volkanozcan2
volkanozcan2 / rnd_pixel.go
Created October 16, 2020 18:09
faker go library usage sample.
package main
import (
"fmt"
"github.com/bxcodec/faker"
)
type pixel struct {
R, G, B uint8
@volkanozcan2
volkanozcan2 / colab-anticonnect.py
Created May 16, 2022 20:42
google colab prevent disconnection if possible.
#@markdown #**Anti-Disconnect for Google Colab**
#@markdown ## Run this to stop it from disconnecting automatically
#@markdown **(disconnects anyhow after 6 - 12 hrs for using the free version of Colab.)**
#@markdown *(Pro users will get about 24 hrs usage time[depends])*
#@markdown ---
import IPython
js_code = '''
function ClickConnect(){
console.log("Working");