Skip to content

Instantly share code, notes, and snippets.

View 19h's full-sized avatar
✔️
This account is verified.

Kenan Sulayman 19h

✔️
This account is verified.
View GitHub Profile
@19h
19h / apx_signal.c
Created February 6, 2014 14:40
0x787061 — apx — Signal test.
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
static void _(int signo) {
long __ = 0x0;
__ += 45; __ <<= 1;
__ *= ((0x8D << 1) * 0x137) - 1;
__ -= 0x2 >> 1;
@19h
19h / verifymx.js
Created February 13, 2014 20:08
Invalid Mail Detection for Node.js. Looksup against static list, then calls the mogelmail.de API and finally requests the target MX server to obtain the state of the mail address.
var dns = require("dns"),
net = require("net");
var nops = {};
var fs = require("fs"),
http = require("http");
// read trash mail domains
fs.readFileSync("./verifymx_trashmail")
@19h
19h / wouter.js
Created February 28, 2014 19:14
A server written with plain TCP sockets in Node. Needs files residing in ./static/.
var methods = [ "GET" ];
var protocol = [ "HTTP/1.1", "HTTP/1.0" ];
var errorCodes = {
100: "Continue",
101: "Switching Protocols",
102: "Processing",
200: "OK",
201: "Created",
202: "Accepted",
@19h
19h / jericho.js
Last active August 29, 2015 13:58
Facebook social network grapher using d3, hyperlevel and Legify Opengraph. Run npm i hyperlevel opengraph before using.
var level = require("hyperlevel");
og = require("opengraph"),
gHost = "local.sly.mn",
gMethod = "http",
FBconf = {
client_id: "---------",
client_secret: "--------------------------------",
scope: "email, user_about_me, user_birthday, user_location, publish_actions, offline_access",
redirect_uri: gMethod + "://" + gHost + "/auth/fb"
};
@19h
19h / harmony.js
Last active August 29, 2015 14:01
Javascript Harmony (ES6) detection and >=0.11 Node.js requirement.
try {
(new Map).set();
require("assert").ok((process.version.split(".")[1]|0) > 10);
} catch (e) {
console.log("\nSupport for ES5 environments was dropped.\nES6 is required; Please upgrade to >= 0.11 and run node with --harmony.\n\nYou are currently using " + process.version + ".\n\n"), process.reallyExit()
}
@19h
19h / wtr_chat.js
Created May 14, 2014 11:08
Funny little, co-routines abusing chat server based on raw tcp sockets, made for @wtr7.
["net", "fs", "querystring", "child_process", "co"].forEach(function (v) {
global[v] = require(v)
});
var users = {/*
nick: socket
*/};
var operators = {
"apx": "123456789",
@19h
19h / client.js
Last active August 29, 2015 14:01
End to end encrypted TCP-based RPC server and client. (for training DiffieHellman and CipherIV with our intern @wtr7) — Tested with io.js 1.2.0 on OS X Yosemite (10.10.3).
["crypto", "net"].forEach(function (m) { global[m] = require(m) })
var api = {
key: Buffer([
0x01, 0xB9, 0x43, 0xE4, 0x8B, 0xBD, 0x33, 0x91, 0xF1, 0xE1, 0x25, 0x32, 0xEC, 0x3B, 0xD3, 0x36,
0x5B, 0xB9, 0x5B, 0x96, 0xD9, 0xA0, 0xF5, 0x22, 0x54, 0x31, 0x99, 0xF8, 0xB5, 0xBF, 0x4E, 0xE3
]),
iv: Buffer([
0x4d, 0x4e, 0x34, 0x58, 0x37, 0x66, 0x61, 0x43, 0x4f, 0x52, 0x34, 0x50, 0x45, 0x43, 0x38, 0x4b
@19h
19h / basic.js
Last active August 29, 2015 14:02
Node.js Professionals Alliance Berlin #1 Meetup: Generators
var Foo = function * (c) {
var a = [0, 1],
b = 0;
for (b = 0; b < c; ++b) {
a.push(a[0] + a[1]);
a.shift();
yield a[a.length - 1];
}
@19h
19h / basic.js
Last active August 29, 2015 14:02
Node.js Professionals Alliance Berlin #1 Meetup: DiffieHellman
// Please refer to http://nodejs.org/dist/v0.11.10/docs/api/crypto.html
var crypto = require("crypto");
// see modp.txt for group specifications!
var alice = crypto.getDiffieHellman("modp14"),
bob = crypto.getDiffieHellman("modp14");
alice.generateKeys();
bob.generateKeys();
@19h
19h / keybase.md
Created July 5, 2014 14:50
keybase.md

Keybase proof

I hereby claim:

  • I am kenansulayman on github.
  • I am apx (https://keybase.io/apx) on keybase.
  • I have a public key whose fingerprint is 74BD 49D0 DABB 7AB9 C1CE 8A67 9337 CFF2 ED85 FF40

To claim this, I am signing this object: