Skip to content

Instantly share code, notes, and snippets.

View BastinRobin's full-sized avatar
🔬
Trying Odd's on daily basis ;)

Bastin Robin BastinRobin

🔬
Trying Odd's on daily basis ;)
View GitHub Profile
@BastinRobin
BastinRobin / example.com
Created October 29, 2015 15:34 — forked from mignev/example.com
Django deployment with Nginx and Tornado Web
upstream tornadoFrontends {
server 127.0.0.1:8000;
server 127.0.0.1:8001;
server 127.0.0.1:8002;
server 127.0.0.1:8003;
}
server {
listen 80;
@BastinRobin
BastinRobin / supervisord-example.conf
Created October 28, 2015 18:03
Example configuration file for supervisord.conf
[unix_http_server]
file=/tmp/supervisor.sock ; path to your socket file
[supervisord]
logfile=/var/log/supervisord/supervisord.log ; supervisord log file
logfile_maxbytes=50MB ; maximum size of logfile before rotation
logfile_backups=10 ; number of backed up logfiles
loglevel=error ; info, debug, warn, trace
pidfile=/var/run/supervisord.pid ; pidfile location
nodaemon=false ; run supervisord as a daemon
@BastinRobin
BastinRobin / pythonTidy.py
Created October 22, 2015 15:04
PythonTidy
#!/usr/bin/python
# -*- coding: utf-8 -*-
# PythonTidy.py
# 2006 Oct 27 . ccr
'''PythonTidy.py cleans up, regularizes, and reformats the text of
Python scripts.
===========================================
@BastinRobin
BastinRobin / get_memory.ph
Created October 5, 2015 15:39
Get Process Memory Data + Head
import time
def get_memory(sajith):
start = time.time()
f = open(sajith)
for line in f.readlines():
a = line.split(':')
a[1] = a[1].strip()
if(a[0] == 'VmData'):
@BastinRobin
BastinRobin / get_memory.ph
Created October 5, 2015 15:39
Get Process Memory Data + Head
import time
def get_memory(sajith):
start = time.time()
f = open(sajith)
for line in f.readlines():
a = line.split(':')
a[1] = a[1].strip()
if(a[0] == 'VmData'):
@BastinRobin
BastinRobin / solution.py
Created September 27, 2015 15:06
Diagonal Difference
'''Problem Statement
You are given a square matrix of size N×N. Calculate the absolute difference of the sums across the two main diagonals.
Input Format
The first line contains a single integer N. The next N lines contain N integers (each) describing the matrix.
Constraints
1≤N≤100
@BastinRobin
BastinRobin / FrequencyCount.py
Created July 22, 2015 07:39
Count the word frequencies of text file
import csv
data = open('data.txt', 'r')
for line in data.readlines():
tokens = line.split()
# iterate througt the list
# count the existence
d = {}
for word in tokens:
# To run this command:
# curl https://gist.githubusercontent.com/tianhuil/0aa9b265f55413dc7198/raw > setup_digitalocean.sh
# . setup_digitalocean.sh
# Update sudo apt-get
sudo apt-get update
# Installing scientific Python
sudo apt-get -y install --fix-missing build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev
sudo apt-get -y install --fix-missing build-essential python-sklearn
import torndb
mysql_settings = {
'host': 'localhost:3306',
'user': 'user',
'password': 'password',
'database': 'database',
'time_zone': '-8:00',
'charset': 'utf8'