Skip to content

Instantly share code, notes, and snippets.

View diptangsu's full-sized avatar
:octocat:
Don't forget to drink water

Diptangsu Goswami diptangsu

:octocat:
Don't forget to drink water
View GitHub Profile
@utek
utek / Exclude_tables.md
Last active June 6, 2024 08:11
Define ignored tables in alembic.ini

Add this in your ini file:

[alembic:exclude]
tables = spatial_ref_sys

In env.py:

    import re 
    
@sloria
sloria / bobp-python.md
Last active November 14, 2024 15:01
A "Best of the Best Practices" (BOBP) guide to developing in Python.

The Best of the Best Practices (BOBP) Guide for Python

A "Best of the Best Practices" (BOBP) guide to developing in Python.

In General

Values

  • "Build tools for others that you want to be built for you." - Kenneth Reitz
  • "Simplicity is alway better than functionality." - Pieter Hintjens
@rxaviers
rxaviers / gist:7360908
Last active November 17, 2024 04:47
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@walkermatt
walkermatt / web.config
Created August 15, 2014 10:28
Enable CORS IIS7
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
<add name="Access-Control-Allow-Headers" value="Accept,Content-Type,X-Requested-With" />
</customHeaders>
</httpProtocol>
</system.webServer>
@Zearin
Zearin / python_decorator_guide.md
Last active November 15, 2024 16:12
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@lu911
lu911 / mixins.py
Created December 13, 2014 17:52
SQLAlchemy Mixins
# -*- coding:utf-8 -*-
from flask import abort
from datetime import datetime
from project.ext import db
class IdMixin(object):
"""
Provides the :attr:`id` primary key column
@pinkshrub
pinkshrub / gist:6c7153e45a844a7a7bedc5111c56f672
Last active February 15, 2022 12:21
Flash Messages in Django

#Flash messages

DOCUMENTATION

###RECAP: One time messages. "Allows you to store messages in one request & retrieve them for display in a subsequent(usually next) request"

###Overview In django, flashed messages are part of the messages app that is included in the generic django-admin startproject command. When used, a message object is added to the request object(via session/cookie) that is readily available for use in views or templates in subsequent requests. Each flash message is an instance of the Message class which has the following attributes:

@pratos
pratos / condaenv.txt
Created November 30, 2016 07:01
To package a conda environment (Requirement.txt and virtual environment)
# For Windows users# Note: <> denotes changes to be made
#Create a conda environment
conda create --name <environment-name> python=<version:2.7/3.5>
#To create a requirements.txt file:
conda list #Gives you list of packages used for the environment
conda list -e > requirements.txt #Save all the info about packages to your folder
" plugins
set nocompatible
filetype off
let need_to_install_plugins=0
if empty(system("grep lazy_load ~/.vim/bundle/vundle/autoload/vundle.vim"))
echo "Installing Vundle..."
echo ""
silent !mkdir -p ~/.vim/bundle
silent !rm -rf ~/.vim/bundle/vundle
silent !git clone https://github.com/gmarik/vundle ~/.vim/bundle/vundle