Skip to content

Instantly share code, notes, and snippets.

View raviprakashgiri's full-sized avatar

ravi prakash giri raviprakashgiri

  • San Francisco, US
View GitHub Profile
#!/bin/bash
# Author : Akshay Pratap Singh
# Email-id : pratapakshay0@gmail.com
# These variable are sets by user
SERVER_IP="127.0.0.1"
HOST_NAME="example.com"
DIR_PATH=$(pwd)
APACHE_DIR_PATH="/etc/apache2/sites-available"
@raviprakashgiri
raviprakashgiri / csv_extract.py
Created January 15, 2015 05:57
Python script for extracting any particular column value from a csv or txt files.
# data.csv entries
# r,first,c,f,last,h,k
# 1,1957154100,T,37809,8721867,P,200
# 2,15393876652,T,289998,35330317,P,199
# 3,13971080937,T,270583,113047,P,3
# 4,345103649,T,5752,45936,P,1
# 5,151604200,T,2939,94215,P,2
# 6,251593100,T,4980,66352,P,2
# 7,151784831,T,2975,80168,P,2
@raviprakashgiri
raviprakashgiri / bar_graph.py
Created January 15, 2015 06:05
Script to create a simple Bar Graph of very large data using python plotly library.
import plotly.plotly as py
from plotly.graph_objs import *
# auto sign-in with credentials or use py.sign_in()
a=10
b=22
c=33
trace1 = Bar(
x=[1,2,3],y=[a,b,c]
)
@raviprakashgiri
raviprakashgiri / value_extractor.py
Last active January 25, 2016 05:59
Script to extract value corresponding to one column in file 1 from two other files.
# Input files from which first 5 columns have to be retained: input0.csv
# Input files from which column's content have to be copied: input1,input2, input3.csv
# It searches value in other three columns from csv files, corresponding to column value in input0.csv
# Author Ravi Prakash Giri
import os
file0=open('input0.csv','r')
file1=open('input1.csv','r')
file2=open('input2.csv','r')
@raviprakashgiri
raviprakashgiri / line_graphs.py
Created January 25, 2016 06:08
Four line graphs
# Author Ravi Prakash Giri
import re
import matplotlib.pyplot as plt
from math import log
eq_files=[]
values=[]
fig, ax = plt.subplots(figsize=(120,7))
mkr=['*','o','h','d','p','8','>','^','<',7]
@raviprakashgiri
raviprakashgiri / expected.py
Last active January 25, 2016 06:09
Expected Probability Python Code
# Author Ravi Prakash Giri
import sys
total = 0
def fact(n):
total = n
while n > 1:
total *= (n - 1)
@raviprakashgiri
raviprakashgiri / sort_wrt_columns.py
Created February 3, 2016 14:40
Sorting a comma separated file according to the columns
#there are three columns. This script is gonna sort the file first w.r.t. column 3 then further w.r.t. column 2
import csv
def getKey(item):
return int(item[0])
def getKey1(item):
return int(item[1])
def getKey2(item):
return int(item[2])
#include <iostream>
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
#include <fstream>
#include <sstream>
#include <string>
#include <vector>
@raviprakashgiri
raviprakashgiri / find_string_pcap.sh
Last active February 27, 2017 00:49
find a string in a pcap
#!/bin/bash
value=`cat adult.txt` # files from which string input has been taken
for i in ${value[@]}; do tshark -r test.pcap -T fields -e ip.src -e ip.dst -e data |\
grep `echo -n $i | xxd -p` |\
cut -f 1| uniq > $i; echo $i; done#
@raviprakashgiri
raviprakashgiri / install-oh-my-zsh-on-ubuntu
Created June 15, 2017 17:26 — forked from richardtape/install-oh-my-zsh-on-ubuntu
Install Oh My ZSH on Ubuntu 14.04
# Where is the location of your current shall. Useful if we need to revert
echo $0
# Install ZSH
sudo apt-get install zsh
# Instal GIT
sudo apt-get install git-core
# Install OhMyZSH