Skip to content

Instantly share code, notes, and snippets.

View deepakkoirala's full-sized avatar

Deepak Koirala deepakkoirala

View GitHub Profile
deepakkoirala / d3.sankey.js
Created January 11, 2019 16:59 — forked from emeeks/d3.sankey.js
Sankey Particles
d3.sankey = function() {
var sankey = {},
nodeWidth = 24,
nodePadding = 8,
size = [1, 1],
nodes = [],
links = [];
sankey.nodeWidth = function(_) {
if (!arguments.length) return nodeWidth;
deepakkoirala / upload.php
Created August 10, 2019 20:16 — forked from taterbase/upload.php
Simple file upload in php
<!DOCTYPE html>
<title>Upload your files</title>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
deepakkoirala /
Created August 31, 2019 19:57 — forked from anhldbk/
TLS client & server in NodeJS

1. Overview

This is an example of using module tls in NodeJS to create a client securely connecting to a TLS server.

It is a modified version from documentation about TLS, in which:

  • The server is a simple echo one. Clients connect to it, get the same thing back if they send anything to the server.
  • The server is a TLS-based server.
  • Clients somehow get the server's public key and use it to work securely with the server

2. Preparation

deepakkoirala / tcpproxy.js
Created August 31, 2019 20:00 — forked from kfox/tcpproxy.js
A basic TCP proxy written in node.js
var net = require("net");
process.on("uncaughtException", function(error) {
if (process.argv.length != 5) {
console.log("usage: %s <localport> <remotehost> <remoteport>", process.argv[1]);
deepakkoirala / nodejs-tcp-example.js
Created September 1, 2019 17:52 — forked from tedmiston/nodejs-tcp-example.js
Node.js TCP client and server example
In the node.js intro tutorial (, they show a basic tcp
server, but for some reason omit a client connecting to it. I added an
example at the bottom.
Save the following server in example.js:
var net = require('net');
deepakkoirala / gist:7fc74fabee11b5b3c4382312a50db479
Created September 7, 2019 19:59 — forked from corvax19/openssh-encrypt-decrypt.txt
Simple text encryption/decryption with openssl
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a
Encrypt with interactive password. Encrypted message is base64-encoded afterwards.
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a -k "MySuperPassword"
Encrypt with specified password. Encrypted message is base64-encoded afterwards.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc
Base-64 decode and decrypt message with interactive password.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc -k "MySuperPassword"
deepakkoirala /
Created September 11, 2019 21:29 — forked from umidjons/
Extending EventEmitter example

Extending EventEmitter example

"use strict";

var EventEmitter = require('events').EventEmitter;

class MyClass extends EventEmitter {
 * Create MyClass instance
deepakkoirala /
Created September 11, 2019 21:29 — forked from umidjons/
UDP Client/Server example

UDP Client/Server example

File server.js:

'use strict';

var dgram = require('dgram');
var server = dgram.createSocket('udp4');

const PORT = 3000;
deepakkoirala / index.html
Created September 11, 2019 21:30 — forked from umidjons/index.html
Upload File using jQuery.ajax() with progress support
<!doctype html>
<html lang="en">
<meta charset="UTF-8">
<title>Upload File using jQuery.ajax() with progress support</title>
<input type="file" name="file" id="sel-file"/>
deepakkoirala / remove-rubber-band-web-apps-ios
Created January 3, 2020 21:47 — forked from amolk/remove-rubber-band-web-apps-ios
Remove rubberband scrolling from web apps on mobile safari (iOS)
<!DOCTYPE html>
<title>Remove rubberband scrolling from web apps on mobile safari (iOS)</title>
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-touch-fullscreen" content="yes">
<meta id="extViewportMeta" name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no">
<script type="text/javascript" src=""></script>
html, body {margin: 0; padding: 0; overflow: hidden}