Skip to content

Instantly share code, notes, and snippets.

View vik-y's full-sized avatar

Vikas Yadav vik-y

View GitHub Profile
@vik-y
vik-y / live-score.py
Created March 20, 2016 16:34
Script to get Live score from cricbuzz website.
import time
import re
headers = {'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36'}
def cleanhtml(raw_html):
cleanr =re.compile('<.*?>')
cleantext = re.sub(cleanr,'', raw_html)
return cleantext
def liveScore():
@vik-y
vik-y / README.md
Created March 30, 2018 15:17
Steps to get jenkins up and running

RVM, Ruby and Gemstash Installation

This is required to speed up bundle install. RVM Installation is fairly simple for ubuntu systems.

# Refer to https://github.com/rvm/ubuntu_rvm
sudo apt-add-repository -y ppa:rael-gc/rvm
sudo apt-get update
sudo apt-get install rvm

# After this installation ruby 
rvm install 2.4
@vik-y
vik-y / 000-default.conf
Created December 20, 2017 12:26
Docker config on my local machine
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ProxyPass / http://localhost:8082/
ProxyPassReverse / http://localhost:8082/
ProxyPreserveHost On
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
@vik-y
vik-y / commands.sh
Created December 18, 2017 18:46
Frequently used commands by me for managing my server
# To compress a folder
tar czf archivename.tar.gz folder
# To email a file
echo "PFA apache config" | mutt -s "/etc/apache2" vikasyadavgood@gmail.com -a apache.tar.gz
@vik-y
vik-y / d7install.bash
Created November 23, 2017 07:49 — forked from ricardoamaro/d7install.bash
Drupal Installation Script for Linux Debian/Ubuntu
#!/bin/bash -e
#############################
#
# Auto Install Drupal on Debian/Ubuntu boxes
# Author: ricardo amaro
# https://drupal.org/user/666176
#
# License: http://www.gnu.org/licenses/gpl-2.0.html
#
@vik-y
vik-y / amahi_design.md
Last active August 27, 2017 08:41
Design document to explain the changes done in amahi codebase

Design Document

Amahi now supports Docker. It is an open source software for automating the deployment of applications inside software containers. A container image is a lightweight, stand-alone, executable package of a piece of software that includes everything needed to run it: code, runtime, system tools, system libraries, settings.

For more information related to contianers refer to : https://www.docker.com/what-container

The idea was to get/build images of different applications and run them using docker on the hda. The benefit of using containers as opposed to the earlier method is that each container runs in an isolated environment. So they can each have different versions of different applications. For example we can have an app running on php5 and another app running on php7. Using this method if we had an image available for an app then we can directly run it using docker without any problems.

Architecture Overview : How it works? Diagram

@vik-y
vik-y / amahi.md
Last active August 22, 2017 15:14
Documentation for contianer apps in Amahi.

Amahi Documentation

Important Terms

Before going further in this document, understanding the following terms might be useful:

Problem Statement

Amahi supports one click install for different kind of apps. To add any app to amahi they have to be packaged properly. Each app might require a completely different environment to run and it might not be possible to provide that environment to every app because their can be dependnecy conflicts. For example some app might require php5 and some might require php7. We need a mechanism to address this concern such that we can add any app to Amahi irrespective of the technology stack that it might require or without version conflicts.

@vik-y
vik-y / CHANGES.MD
Last active July 15, 2017 08:48
Amahi Changes documentation

Dependencies Added

docker-api added in Gemfile. For more details on docker-api refer to https://github.com/swipely/docker-api

Modifications in app/models/app.rb

Firstly I added a few lines to make sure that docker.sock had right permissions. I was facing some issues because the process which runs installer doesn't have the permission to write to docker.sock. We tried various fixes but they didn't work and hence shifted to this temporary workaround

        def install_bg
+               # Change permissions of docker.sock file
+               if Rails.env=="production"
@vik-y
vik-y / runtime_error.cpp
Created July 5, 2017 07:35
Static variables, functions, references and everything , they behave in a very complex. This gist tries to experiment with those concepts
#include<iostream>
using namespace std;
int main()
{
int *ptr = NULL;
int &ref = *ptr; // We are initializing the reference.
cout << ref;
}
@vik-y
vik-y / minheap.cpp
Last active June 19, 2017 13:17
MinHeap example in C++
#include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
// Modify the comparator function to change the heap type
struct comparator {
bool operator()(int i, int j) {
return i > j;
}