Skip to content

Instantly share code, notes, and snippets.

View neophyt3's full-sized avatar
🎯
Focusing

Pradeep Chauhan neophyt3

🎯
Focusing
  • Mumbai, India
View GitHub Profile
  • What do Etcd, Consul, and Zookeeper do?
    • Service Registration:
      • Host, port number, and sometimes authentication credentials, protocols, versions numbers, and/or environment details.
    • Service Discovery:
      • Ability for client application to query the central registry to learn of service location.
    • Consistent and durable general-purpose K/V store across distributed system.
      • Some solutions support this better than others.
      • Based on Paxos or some derivative (i.e. Raft) algorithm to quickly converge to a consistent state.
  • Centralized locking can be based on this K/V store.
@neophyt3
neophyt3 / concurrency.go
Created February 11, 2018 20:14 — forked from montanaflynn/concurrency.go
A simple example of bounded concurrency and wait groups in Golang
package main
import (
"fmt"
"sync"
"time"
)
func main() {
@neophyt3
neophyt3 / irctc.py
Created June 26, 2017 19:42 — forked from avamsi/irctc.py
Python script to semi-automate tatkal ticket booking.
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import Select, WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from time import sleep, strftime
def waituntil(s):
while strftime('%H:%M:%S') < s:
print strftime('%H:%M:%S')
sleep(1)
@neophyt3
neophyt3 / encrypt_decrypt_example.js
Created May 10, 2017 07:00 — forked from erans/encrypt_decrypt_example.js
Example of encryption and decryption in node.js
var crypto = require("crypto")
function encrypt(key, data) {
var cipher = crypto.createCipher('aes-256-cbc', key);
var crypted = cipher.update(text, 'utf-8', 'hex');
crypted += cipher.final('hex');
return crypted;
}
@neophyt3
neophyt3 / gist:921b326ff2dded2e02600c14e143e47f
Created March 20, 2017 16:36 — forked from dbrugne/gist:2a62d4dd88f11fa36b75
MongoDB bulk insert from mongoose models
var mongoose = require('mongoose');
var hitSchema = mongoose.Schema({
text: String,
music: String
});
hitSchema.statics.bulkInsert = function(models, fn) {
if (!models || !models.length)
return fn(null);
@neophyt3
neophyt3 / sql-mongo_comparison.md
Created March 19, 2017 19:34 — forked from aponxi/sql-mongo_comparison.md
MongoDb Cheat Sheets

SQL to MongoDB Mapping Chart

SQL to MongoDB Mapping Chart

In addition to the charts that follow, you might want to consider the Frequently Asked Questions section for a selection of common questions about MongoDB.

Executables

The following table presents the MySQL/Oracle executables and the corresponding MongoDB executables.

@neophyt3
neophyt3 / mongodb.md
Created March 19, 2017 19:31
#mongodb cheat sheet

MongoDB cheat sheet

Overview

Overview

MongoDB is a document database that provides high performance, high availability, and easy scalability.

  • Document Database
@neophyt3
neophyt3 / README.md
Created January 22, 2017 13:07 — forked from magnetikonline/README.md
Nginx FastCGI cache configuration example.

Nginx FastCGI cache

Example /etc/nginx/nginx.conf using FastCGI (e.g. to PHP-FPM) with FastCGI cache enabled. This will capture returned data and persist it to a disk based cache store for a configurable amount of time, great for robust full page caching.

Will need to create a directory to hold cache files, for the example given here that would be:

$ sudo mkdir -p /var/cache/nginxfastcgi
$ chown www-data: /var/cache/nginxfastcgi
@neophyt3
neophyt3 / installing.md
Created January 22, 2017 12:23 — forked from githubjeka/installing.md
How install PHP 5.6.0, Nginx, php-fpm on Debian

#Download Sorce PHP

mkdir /opt/php-5.6.0
mkdir /usr/local/src/php5-build
cd /usr/local/src/php5-build
wget http://de.php.net/get/php-5.6.0.tar.bz2/from/this/mirror -O php-5.6.0.tar.bz2
tar jxf php-5.6.0.tar.bz2
cd php-5.6.0/