Skip to content

Instantly share code, notes, and snippets.

Avatar
🦔
! fox

Espoir Murhabazi espoirMur

🦔
! fox
View GitHub Profile
@MrEliptik
MrEliptik / text_preprocessing.py
Created Jan 14, 2019
A python script to preprocess text (remove URL, lowercase, tokenize, etc..)
View text_preprocessing.py
import re, string, unicodedata
import nltk
import contractions
import inflect
from nltk import word_tokenize, sent_tokenize
from nltk.corpus import stopwords
from nltk.stem import LancasterStemmer, WordNetLemmatizer
def replace_contractions(text):
"""Replace contractions in string of text"""
@Bergvca
Bergvca / unnittestexample.py
Last active May 13, 2022
Some unnittest + Mock examples in Python. Includes examples on how to mock a entire class (ZipFile), mock an Iterator object and how to use side_effect properly
View unnittestexample.py
import unittest
import os
from zipfile import ZipFile
from mock import MagicMock, patch, Mock, mock_open
# The functions that are tested:
def function_to_test_zipfile(example_arg):
with ZipFile(example_arg, 'r') as zip_in:
for input_file in zip_in.infolist():
@Brachamul
Brachamul / command
Created Dec 26, 2016
Set an existing user to superuser using Django shell
View command
python manage.py shell
View Effective_Engineer.md

FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@onjin
onjin / docker-compose.yml
Created Sep 5, 2016
example docker compose for postgresql with db init script
View docker-compose.yml
postgres:
image: postgres:9.4
volumes:
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
@PurpleBooth
PurpleBooth / README-Template.md
Last active Aug 19, 2022
A template to make good README.md
View README-Template.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

@kirang89
kirang89 / model_relation_ex.py
Created Apr 7, 2014
Example for many-to-many relationship with extra columns in SQLAlchemy
View model_relation_ex.py
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()