Skip to content

Instantly share code, notes, and snippets.

View vikas17a's full-sized avatar

Vikas Aggarwal vikas17a

View GitHub Profile
@vikas17a
vikas17a / serve_http.py
Created January 2, 2016 11:45 — forked from pankajp/serve_http.py
Simple Python HTTP Server with multi-threading and partial-content support
#! /usr/bin/env python
# Standard library imports.
from SocketServer import ThreadingMixIn
import BaseHTTPServer
import SimpleHTTPServer
import sys
import json
import os
from os.path import (join, exists, dirname, abspath, isabs, sep, walk, splitext,
@vikas17a
vikas17a / Dashing EC2.md
Created October 28, 2015 09:56 — forked from jwalton/Dashing EC2.md
EC2 CloudWatch stats for Dashing

Get EC2 CloudWatch stats and graph them in Dashing.

@vikas17a
vikas17a / jsonlite.sh
Last active September 22, 2015 14:09
Enhanced Jsonlite
#!/bin/bash
set -e
VERSION="0.4.0"
COMMAND=$1
CWD=$(pwd);
case "$COMMAND" in
"set")
@vikas17a
vikas17a / !README.md
Created September 2, 2015 16:03
Nagios plugin for check last updated ami

#Setting up nagios plugin for ami check

  • copy check_ami.py to your nagios plugin directory
  • give executable permission check_ami.py
  • copy config file in you nagios plugin directory add your id and key
  • change command file and add new command
define command{
    command_name    check_ami
    command_line    $USER1$/check_ami.py $ARG1$ $ARG2$ "$ARG3$"
}
@vikas17a
vikas17a / Readme.md
Created July 28, 2015 07:54
Vault server setup

== Step to install vault

  • Download vault
wget https://dl.bintray.com/mitchellh/vault/vault_0.2.0_linux_386.zip
  • Create and edit config
    • Create config
@vikas17a
vikas17a / testfab.py
Created July 22, 2015 06:13
Testing fabric with python
#!/usr/bin/env python
from fabric.api import *
def uptime():
local('uptime')
def remote_add():
local('git init')
local('git remote add origin https://github.com/vikas17a/testfab.git')
local('git pull origin master')
@vikas17a
vikas17a / automated_google_authentication.sh
Created July 16, 2015 12:19
google-authentication questionnaire automated
RESULT=$(google-authenticator <<!
y
y
y
n
y
!
)
echo $RESULT | awk '{print "QR Code URL:\n"$10}'
@vikas17a
vikas17a / Readme.md
Last active August 29, 2015 14:25
Setting up two way authentication (PubKey + Google Authentication)

Instruction for setting up two way authentication (PubKey + Google Authenticator)

==

Installing pam for google-authenticator

sudo yum install make gcc pam-devel

TOTP (timebased one-time-password) security tokens are time sensitive. Hence, make sure that your system has ntpd running, and is configured to start the service at boot:

sudo yum install ntp
@vikas17a
vikas17a / echo_server.py
Created July 13, 2015 07:59
A simple echo server
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):

Setting up hastebin server

  • Set up and start redis server
  • Enter following command in clone
git clone https://github.com/seejohnrun/haste-server.git && cd haste-server/
cat config.js #setup configuration of hastebin server port and redis server port
npm install
npm start &> /dev/null/ &

User this server IP and Port in following steps to setup command line code paste to haste-server