Skip to content

Instantly share code, notes, and snippets.

Software Name as Headline
======
**Software Name** is a software for things. Short description here.
#### Screenshot
![Screenshot software](http://url/screenshot-software.png "screenshot software")
## Download
* [Version X.Y](https://github.com/username/sw-name/archive/master.zip)
* Other Versions
Script Name as Headline
======
**Script Name** is a script for things. The usage is explained like this:
```
$ ./script parameter1 .. parameterN
Output
$
```
## Version
@elyasha
elyasha / dev-tools-wsl2
Created September 28, 2020 10:35
Dev tools for wsl 2.0
sudo apt update && sudo apt upgrade
sudo apt install build-essential default-jdk libssl-dev exuberant-ctags ncurses-term fontconfig software-properties-common git curl lib32readline-dev sqlite3 libsqlite3-dev
sudo apt install postgresql postgresql-contrib memcached libmemcached-dev
sudo apt install zlib1g-dev libffi-dev libbz2-dev libreadline-dev
@elyasha
elyasha / celery-worker-windows
Created October 23, 2020 09:42
Run celery workers in windows
celery -A proj worker -l INFO -P gevent -E
os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
# Define your functions
def print_message():
print("I'm sorry, I did not understand your selection. Please enter the corresponding letter for your response.")
def get_drink_type():
res = input('What type of drink would you like? \n[a] Brewed Coffee \n[b] Mocha \n[c] Latte \n> ')
if res == "a":
return "brewed coffee"
elif res == "b":
return "mocha"
# regex for removing punctuation!
import re
# nltk preprocessing magic
import nltk
from nltk.tokenize import word_tokenize
from nltk.stem import PorterStemmer
from nltk.stem import WordNetLemmatizer
# grabbing a part of speech function:
from part_of_speech import get_part_of_speech
@elyasha
elyasha / .\looking_glass.py
Created October 31, 2020 15:09
Bag-of-words can be an excellent way of looking at language when you want to make predictions concerning topic or sentiment of a text. When grammar and word order are irrelevant, this is probably a good model to use.
looking_glass_text = """
However, the egg only got larger and larger, and more and more human: when she had come within a few yards of it, she saw that it had eyes and a nose and mouth; and when she had come close to it, she saw clearly that it was HUMPTY DUMPTY himself. It cant be anybody else! she said to herself. Im as certain of it, as if his name were written all over his face.
It might have been written a hundred times, easily, on that enormous face. Humpty Dumpty was sitting with his legs crossed, like a Turk, on the top of a high wallsuch a narrow one that Alice quite wondered how he could keep his balanceand, as his eyes were steadily fixed in the opposite direction, and he didnt take the least notice of her, she thought he must be a stuffed figure after all.
And how exactly like an egg he is! she said aloud, standing with her hands ready to catch him, for she was every moment expecting him to fall.
Its very provoking, Humpty Dumpty said after a long silence, looking away from Alice as he spoke,
import nltk, re
from nltk.tokenize import word_tokenize
# importing ngrams module from nltk
from nltk.util import ngrams
from collections import Counter
from looking_glass import looking_glass_full_text
cleaned = re.sub('\W+', ' ', looking_glass_full_text).lower()
tokenized = word_tokenize(cleaned)
import nltk, re
from nltk.corpus import wordnet
from nltk.corpus import stopwords
from nltk.tokenize import word_tokenize
from nltk.stem import WordNetLemmatizer
from collections import Counter
stop_words = stopwords.words('english')
normalizer = WordNetLemmatizer()