Skip to content

Instantly share code, notes, and snippets.

View shivamMg's full-sized avatar

shivam mamgain shivamMg

View GitHub Profile
@shivamMg
shivamMg / index.html
Created November 9, 2015 11:07
ojaJMv
<html>
<body>
<div id="map"></div>
</body>
</html>
@shivamMg
shivamMg / captiveportal.py
Created November 23, 2015 14:03
Connect to captive-portal with a list of username-passwords
#!/usr/bin/python3
import requests
import time
import re
# Connection Delay in seconds
conn_delay = 30
# File with space separated username-passwords on each line
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="author" content="">
<title></title>
package main
import "strings"
func main() {
// Required width
w := 10
st := "Go is a programming language developed at Google in 2007 by Robert Griesemer, Rob Pike, and Ken Thompson."
@shivamMg
shivamMg / swagger.yaml
Last active May 17, 2016 18:03
Swagger spec for existing GET APIs at OE Organizer Server
swagger: "2.0"
info:
title: "Open Event Organizer Server API"
description: "APIs provided by the Open Event Organizer Server"
license:
name: "GNU GPL v3"
url: "https://github.com/fossasia/open-event-orga-server/blob/master/LICENSE.md"
version: "1.0.0"
host: "127.0.0.1:8001"
basePath: "/api/v1"
def comb(n, r):
c = 1
if r > n / 2:
r = n - r
for i in xrange(1, r+1):
c *= n - r + i
c /= i
return c
@shivamMg
shivamMg / euclid-gcd.py
Created September 27, 2016 19:17
EuclideanGCD
def gcd(a, b):
while b != 0:
temp = b
b = a % b
a = temp
return a
@shivamMg
shivamMg / python3kflag.md
Created October 1, 2016 07:50 — forked from rowillia/python3kflag.md
The Magic of the -3 Flag in Python 2

The Magic of the -3 Flag in Python 2

Porting code from Python 2 to Python 3 can be a daunting task. Tools like Futureize or Modernize can do most of the mechanical work for you, and Pylint can find obvious problems with code that's meant to be 2and3 compatible. You should absolutely be using these tools as they identify the lion's share of compatibility problems. Thanks to this work, it's really never been easier to port a large codebase to Python 3.

Even with these tools, however, porting code in a way that ensures identical behavior in Python 2 and Python 3 is tough. Python is a highly dynamic language and there is a huge breadth of changes between Python 2 and Python 3. Also, while we'd all love to work in code bases with 100% unit test coverage, the reality is unfortunately often very different. Given this, it's hard if not impossible for a static analysis tool t

#!/usr/bin/env bash
show_help() {
cat << EOF
Usage: ${0##*/} [-hegpsa] PROXYURL
Change Proxy for app and env. If PROXYURL parameter is not passed, the proxy is unset for that app or env.
-h Display help
-e Change env proxy variables
@shivamMg
shivamMg / .vimrc
Last active December 3, 2016 15:59
set nocompatible
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-sensible'
Plugin 'itchyny/lightline.vim'
Plugin 'morhetz/gruvbox'
call vundle#end()