Skip to content

Instantly share code, notes, and snippets.

View siddharthg's full-sized avatar
:octocat:
Focusing

Siddharth Gupta siddharthg

:octocat:
Focusing
View GitHub Profile
from datetime import timedelta
from functools import update_wrapper
from flask import make_response, request, current_app
def crossdomain(origin=None, methods=None, headers=None,
max_age=21600, attach_to_all=True,
automatic_options=True):
if methods is not None:
methods = ', '.join(sorted(x.upper() for x in methods))
@siddharthg
siddharthg / gist:6923b2cbb402bd65255af7859a5d52a5
Created December 21, 2017 07:29 — forked from timvlaer/gist:721ba30f8fc6a7aac1b0190e132a4261
Install Thrift 0.10.0 with brew on macOS
brew unlink thrift
brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/16ebe5f1843e6cb54856311ff0f676be53007329/Formula/thrift.rb
@siddharthg
siddharthg / version.py
Created March 14, 2017 06:57
Python Version String (Semantic Versioning)
__author__ = "Siddharth"
class Version(str):
def __new__(cls, data=''):
is_none = data is None
o = super(Version, cls).__new__(cls, None if is_none else data.lower())
o._is_none = is_none
return o
@siddharthg
siddharthg / shell.c
Created October 20, 2015 12:52
A small shell written in C.
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
char * RemoveSpace(char *string);//To remove spaces in between file name.
void parse(char *cmd,char **argv);//to save the command line input into an array