Skip to content

Instantly share code, notes, and snippets.

View akkefa's full-sized avatar
💻
Grit

Ikram Ali akkefa

💻
Grit
View GitHub Profile
@akkefa
akkefa / README-Template.md
Created March 15, 2018 05:50 — forked from PurpleBooth/README-Template.md
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites

"""Downloading mp3"""
from bs4 import BeautifulSoup
import re
import requests
import urllib
from os import system
r = requests.get("http://")
@akkefa
akkefa / Makefile
Created March 6, 2018 13:32 — forked from rochacbruno/Makefile
Python Setup Tips and Tricks http://j.mp/setup_py
.PHONY: test install pep8 release clean
test: pep8
py.test --cov -l --tb=short --maxfail=1 program/
install:
python setup.py develop
pep8:
@flake8 program --ignore=F403 --exclude=junk
@akkefa
akkefa / gist:a0827f12b67873de15543bd0c5a0f01f
Created February 28, 2018 08:11 — forked from miohtama/gist:5389146
Decoding emails in Python e.g. for GMail and imapclient lib
import email
def get_decoded_email_body(message_body):
""" Decode email body.
Detect character set if the header is not set.
We try to get text/plain, but if there is not one then fallback to text/html.
:param message_body: Raw 7-bit message body input e.g. from imaplib. Double encoded in quoted-printable and latin-1
@akkefa
akkefa / 1. Install python3.6 & pip3.md
Created February 23, 2018 13:25 — forked from alyssaq/1. Install python3.7 & pip3.md
python3.6 setup on Mac 10.13 (High Sierra)
  1. Install Python 3.6.x from https://www.python.org/downloads/ or via homebrew
    Check that python3 has been installed by running it at the terminal:
$ python3
>>> Python 3.6.4
  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and install (this should already be installed if python was installed from python.org or homebrew):
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
@akkefa
akkefa / 1. Install python3.6 & pip3.md
Created February 23, 2018 13:25 — forked from alyssaq/1. Install python3.7 & pip3.md
python3.6 setup on Mac 10.13 (High Sierra)
  1. Install Python 3.6.x from https://www.python.org/downloads/ or via homebrew
    Check that python3 has been installed by running it at the terminal:
$ python3
>>> Python 3.6.4
  1. Download get-pip.py from https://bootstrap.pypa.io/get-pip.py and install (this should already be installed if python was installed from python.org or homebrew):
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo python3 get-pip.py
@akkefa
akkefa / install-docker.sh
Created February 20, 2018 04:32
Install latest docker CE version in ubuntu through Bash script.
#!/usr/bin/env bash
sudo apt-get update
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
@akkefa
akkefa / SQLAlchemy Cheat Sheet
Created January 27, 2018 15:14
SQLAlchemy is a deep and powerful thing made up of many layers. This cheat sheet sticks to parts of the ORM (Object Relational Mapper) layer,and aims to be a reference not a tutorial. That said, if you are familiar with SQL then this cheat sheet should get you well on your way to understanding SQLAlchemy.
#A SQLAlchemy Cheat Sheet
###Introduction
##Basic Models
One model is used to describe one database table. For example:
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy.orm import scoped_session,sessionmaker
from zope.sqlalchemy import ZopeTransactionExtension
from sqlalchemy import (
from flask.views import MethodView
from flask import jsonify, request, abort, make_response, current_app
from flask_jwt_extended import jwt_required
from agent import Agent
from web.extensions import csrf
from web.blueprints.data.models import Utterance
class SlackAPI(MethodView):
"""
import os
print os.environ['HOME']
# Or you can see a list of all the environment variables using:
os.environ
#As sometimes you might need to see a complete list!
# using get will return `None` if a key is not present rather than raise a `KeyError`
print os.environ.get('KEY_THAT_MIGHT_EXIST')