Skip to content

Instantly share code, notes, and snippets.

View sourcepirate's full-sized avatar
🏠
Work and pray

Sathya Narrayanan sourcepirate

🏠
Work and pray
View GitHub Profile
docker service rm rdb-primary rdb-secondary rdb-proxy
docker network rm rdb-net
sleep 5
docker network create --driver overlay rdb-net
sleep 2
docker service create \
--name rdb-primary \
--network rdb-net \
@sourcepirate
sourcepirate / rsa.py
Created March 18, 2019 03:05
A simple RSA implementation in Python
'''
620031587
Net-Centric Computing Assignment
Part A - RSA Encryption
'''
import random
'''
@sourcepirate
sourcepirate / install.md
Created October 24, 2018 14:35 — forked from montanaflynn/install.md
Quickly install Kong on Ubuntu 14.04

Install Java, Cassandra & Kong on Ubuntu 14.04

sudo apt-get install -y wget
wget -O kong-install.sh http://git.io/vmMjv
cat kong-install.sh
chmod +x kong-install.sh
sudo ./kong-install.sh
source ~/.bash_profile
sudo cassandra
@sourcepirate
sourcepirate / .rustfmt.toml
Created September 15, 2018 16:47 — forked from Robbepop/.rustfmt.toml
.rustfmt.toml with all configs, descriptions, parameters and defaults for version 0.7.1 of rustfmt.
# ----------------------------------------------------------------------------------
# r u s t f m t - C O N F I G
# ==================================================================================
#
# Version: 0.7.1
# Author : Robbepop <[email protected]>
#
# A predefined .rustfmt.toml file with all configuration options and their
# associated description, possible values and default values for use in other
# projects.
@sourcepirate
sourcepirate / pipes.py
Created October 6, 2017 09:22 — forked from zacharyvoase/pipes.py
pipes.py - Command-piping syntax for generators/coroutines in Python.
# -*- coding: utf-8 -*-
# pipes.py - Command-piping syntax for generators/coroutines in Python.
"""
pipes.py - Command-piping syntax for generators/coroutines in Python.
Example:
>>> from pipes import *
>>> chain1 = counter(5) | adder(2)
@sourcepirate
sourcepirate / node_debian_init.sh
Created January 30, 2016 03:50 — forked from peterhost/node_debian_init.sh
Daemon init script for node.js based app/server (DEBIAN/UBUNTU)
#!/bin/sh
# ------------------------------------------------------------------------------
# SOME INFOS : fairly standard (debian) init script.
# Note that node doesn't create a PID file (hence --make-pidfile)
# has to be run in the background (hence --background)
# and NOT as root (hence --chuid)
#
# MORE INFOS : INIT SCRIPT http://www.debian.org/doc/debian-policy/ch-opersys.html#s-sysvinit
# INIT-INFO RULES http://wiki.debian.org/LSBInitScripts
# INSTALL/REMOVE http://www.debian-administration.org/articles/28
@sourcepirate
sourcepirate / astar.py
Created October 3, 2015 06:11 — forked from jamiees2/astar.py
A* Algorithm implementation in python.
# Enter your code here. Read input from STDIN. Print output to STDOUT
class Node:
def __init__(self,value,point):
self.value = value
self.point = point
self.parent = None
self.H = 0
self.G = 0
def move_cost(self,other):
return 0 if self.value == '.' else 1
@sourcepirate
sourcepirate / http.php
Last active September 18, 2015 10:52
simple http request example in php
<?php
/*
* simple HttpRequest example using PHP
* tom slankard
*/
class HttpRequest {
public $url = null;
@sourcepirate
sourcepirate / parse.py
Last active August 29, 2015 14:24 — forked from kssreeram/parse.py
import sys
#
# ParserInput
#
# This class represents the input data and the current
# position in the data.
#
# Brief note about 'max_position':
/**
* An implementation for Mergesort. Less efficient
* than Quicksort. Again, you'd just use Array.sort
* but if you found yourself unable to use that
* there's always this option.
*
* Tests with:
*
* var array = [];
* for(var i = 0; i < 20; i++) {