Skip to content

Instantly share code, notes, and snippets.

View disooqi's full-sized avatar
👷‍♂️
Building Mojrayat, and Labeeb

Mohamed Eldesouki disooqi

👷‍♂️
Building Mojrayat, and Labeeb
View GitHub Profile
#!/bin/sh
# get the start date and time
start_datetime=$(date '+%m_%d_%Y_%H_%M_%S')
echo "${start_datetime} - starting spider ${SPIDER_NAME} - debug: ${DEBUG}"
# go to the spider directory
cd $SPIDER_PATH
# prevent click, which pipenv relies on, from freaking out to due to lack of locale info https://click.palletsprojects.com/en/7.x/python3/
export LC_ALL=en_US.utf-8
@miguelgrinberg
miguelgrinberg / .vimrc
Last active April 4, 2024 19:06
My .vimrc configuration for working in Python with vim
" plugins
let need_to_install_plugins = 0
if empty(glob('~/.vim/autoload/plug.vim'))
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
let need_to_install_plugins = 1
endif
call plug#begin()
Plug 'tpope/vim-sensible'
@MrPawanMall
MrPawanMall / Search Article on Wikipedia via Wikipedia Search API.html
Last active February 23, 2021 11:51
I used a API from Wikipedia API and created a simple wikipedia article scrapper by using html & jQuery(Ajax). Hope you like "Search Article on Wikipedia via Wikipedia Search API"
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Search Article on Wikipedia via Wikipedia Search API</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
<h1 class="p-5 alert alert-dark text-center">
<img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/80/Wikipedia-logo-v2.svg/225px-Wikipedia-logo-v2.svg.png" style="width:100px" />
from observer.observer_pattern import Observable, Observer
class Elf:
name = 'Galadriel'
def nall_nin(self):
print('Elf says: Calling the Overlord ...')
import asyncio
loop = asyncio.get_event_loop()
async def hello():
await asyncio.sleep(3)
print('Hello!')
if __name__ == '__main__':
loop.run_until_complete(hello())
@cbaziotis
cbaziotis / AttentionWithContext.py
Last active April 25, 2022 14:37
Keras Layer that implements an Attention mechanism, with a context/query vector, for temporal data. Supports Masking. Follows the work of Yang et al. [https://www.cs.cmu.edu/~diyiy/docs/naacl16.pdf] "Hierarchical Attention Networks for Document Classification"
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
x (): input
kernel (): weights
Returns:
"""
if K.backend() == 'tensorflow':
@cbaziotis
cbaziotis / Attention.py
Last active March 28, 2023 11:50
Keras Layer that implements an Attention mechanism for temporal data. Supports Masking. Follows the work of Raffel et al. [https://arxiv.org/abs/1512.08756]
from keras import backend as K, initializers, regularizers, constraints
from keras.engine.topology import Layer
def dot_product(x, kernel):
"""
Wrapper for dot product operation, in order to be compatible with both
Theano and Tensorflow
Args:
from __future__ import division
import sys
from itertools import *
from pylab import *
from nltk.corpus import brown
from collections import Counter
# Pick a lowercasing function according to Python version
if sys.version_info.major < 3:
from string import lower
@lavr
lavr / send_email.py
Last active May 10, 2024 10:35
std email vs emails
# see also: http://code.activestate.com/recipes/578150-sending-non-ascii-emails-from-python-3/
import os
import smtplib
from email.utils import formataddr
from email.utils import formatdate
from email.utils import COMMASPACE
from email.header import Header
@tracker1
tracker1 / 01-directory-structure.md
Last active May 4, 2024 19:55
Anatomy of a JavaScript/Node project.

Directory structure for JavaScript/Node Projects

While the following structure is not an absolute requirement or enforced by the tools, it is a recommendation based on what the JavaScript and in particular Node community at large have been following by convention.

Beyond a suggested structure, no tooling recommendations, or sub-module structure is outlined here.

Directories

  • lib/ is intended for code that can run as-is
  • src/ is intended for code that needs to be manipulated before it can be used