Skip to content

Instantly share code, notes, and snippets.

@erayarslan
erayarslan / _if.js
Created November 10, 2016 07:52
_if.js
(function (global) {
"use strict";
global._if = function () {
var args = arguments;
if (args.length == 3) {
(args[0] ? args[1] : args[2])();
} else if (args.length == 4) {
args[0] ? setTimeout(args[1], args[3]) : setTimeout(args[2], args[3]);
@erayarslan
erayarslan / fuck_nat.txt
Last active September 7, 2017 09:58
fuck_nat.txt
http://www.brynosaurus.com/pub/net/p2pnat/
https://tools.ietf.org/html/rfc5128
https://en.wikipedia.org/wiki/Rendezvous_protocol
https://en.wikipedia.org/wiki/UDP_hole_punching
https://github.com/samyk/pwnat
http://superuser.com/questions/885140/how-to-use-udp-hole-punching-for-a-ssh-tunnel-session
http://stackoverflow.com/questions/8993781/torrent-peer-to-peer-connection
https://github.com/jankolkmeier/node-upd-hole-punching
http://quicksorted.com/how-bit-torrent-and-skype-work-behind-a-nat-router/?so
https://www.quora.com/How-does-BitTorrent-deal-with-people-behind-NAT
@erayarslan
erayarslan / dyn_sub.txt
Created November 3, 2016 10:06
dyn_sub.txt
# DNS
| A @ 188.226.235.57 | CNAME * singlepage.ninja.
# nginx
server_name *.singlepage.ninja;
@erayarslan
erayarslan / spider.js
Created November 1, 2016 13:12
spider-comment
document.addEventListener("DOMContentLoaded", init, false);
//
var count = 0;
//
var circle_r = 20;
var circle_w = 25;
@erayarslan
erayarslan / do.cpp
Created November 1, 2016 13:06
dlopen-Example
/**
* @module do.cpp
* @author eray arslan
* @date 06.2015
*
* dylib : g++ -dynamiclib -o do.dylib do.cpp
* so : g++ -bundle -o do.so do.cpp
*
*/
@erayarslan
erayarslan / client.js
Created November 1, 2016 13:04
node.js tcp reconnection and queue example
var PORT = 8001;
var HOST = "localhost";
var net = require('net');
var client = net.connect(PORT, HOST);
var q = []; // queue
var counter = 0;
var firstDroped = false;
var reconnector = undefined;
@erayarslan
erayarslan / client.js
Created November 1, 2016 13:01
node.js tcp example
var Client = function (port, host, next) {
this._counter = 0;
this._reply = {};
this._chunk = "";
this._d_index = -1;
this._interval = 5000;
this._firstDrop = false;
this._port = port;
this._host = host;
this._reconnector = undefined;
var filters = {
"grey": function (color, i) {
var opt = (color.r + color.g + color.b) / 5;
pix[i+0] = opt;
pix[i+1] = opt;
pix[i+2] = opt;
},
"black": function (color, i) {
var opt = (color.r + color.g + color.b) / 3;
if (opt > 255 / 5) {
@erayarslan
erayarslan / golden.html
Created October 27, 2016 01:29
golden ratio calculator with hashchange event
<html>
<head>
<title>golden ratio</title>
</head>
<body>
<div id="point"></div>
<script>
var go = 1;
var timeout = 100; // ms
var el = document.getElementById("point");
@erayarslan
erayarslan / .gitconfig
Created August 23, 2016 12:04
.gitconfig
[user]
name = Eray Arslan
email = blablabla
[alias]
pr = pull --rebase
co = checkout
st = status
ec = config --global -e
br = branch -vv
gr = grep -i