Skip to content

Instantly share code, notes, and snippets.

View MHM5000's full-sized avatar
🏠
Working from home

Mohammad Hossein Mojtahedi MHM5000

🏠
Working from home
View GitHub Profile
@MHM5000
MHM5000 / lines.py
Created February 26, 2024 05:08 — forked from tekknolagi/lines.py
#!/usr/bin/env python
import multiprocessing
import random
import string
import time
def fill_output():
to_fill = num_lines - len(last_output_per_process)
@MHM5000
MHM5000 / wsgi_bjoern.py
Created October 8, 2021 11:04 — forked from gcavalcante8808/wsgi_bjoern.py
Bjoern Django Final
import bjoern
import os, signal
from django.core.wsgi import get_wsgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'app.settings')
app = get_wsgi_application()
NUM_WORKERS = 8
@MHM5000
MHM5000 / data_loading_utils.py
Created October 8, 2019 05:27 — forked from iyvinjose/data_loading_utils.py
Read large files line by line without loading entire file to memory. Supports files of GB size
def read_lines_from_file_as_data_chunks(file_name, chunk_size, callback, return_whole_chunk=False):
"""
read file line by line regardless of its size
:param file_name: absolute path of file to read
:param chunk_size: size of data to be read at at time
:param callback: callback method, prototype ----> def callback(data, eof, file_name)
:return:
"""
def read_in_chunks(file_obj, chunk_size=5000):
@MHM5000
MHM5000 / README.md
Created August 19, 2019 06:30 — forked from genomics-geek/README.md
Setting up a Dockerized web application with Django REST APIs, ReactJS with Redux pattern, and Webpack Hot Reloading! Mouthful.

Guide on how to create and set up a Dockerized web app using Django REST APIs and ReactJS

Hopefully this will answer "How do I setup or start a Django project using REST Framework and ReactJS?"

This is a guide to show you step by step how this can be setup. If you just want to get started, use the cookiecuter I set up cookiecutter-django-reactjs. It basically is a fork of pydanny's cookiecutter, just added the front-end stuff :).

I created this because it was SUCH a pain in the ass setting up a project using all the latest technologies. After some research, I figured it out and have it working. The repo that implements this is located here. Feel free to use it as a boilerplate ;)

Main features:

  • Django REST APIs
@MHM5000
MHM5000 / nginx.conf
Created April 8, 2019 14:11 — forked from roman01la/nginx.conf
Node.js Express Nginx
server {
listen 80;
server_name example.com;
location / {
proxy_pass http://127.0.0.1:3000;
}
location ~ ^/(images/|scripts/|styles/|robots.txt|humans.txt|favicon.ico) {
root /your/app/public/folder;
@MHM5000
MHM5000 / SeleniumGridTutorial.md
Created January 29, 2019 09:52 — forked from dzitkowskik/SeleniumGridTutorial.md
A simple tutorial of using selenium grid in python unittests

Prepare files & libraries

  1. Download selenium standalone server from: http://goo.gl/rQhaxb, Create local folder at ~/selenium and copy or move jar to that path:
$ mkdir ~/selenium
$ cd ~/selenium
$ wget http://goo.gl/rQhaxb
$ mv selenium-server-standalone-2.49.1.jar ~/selenium/
@MHM5000
MHM5000 / flexbox-lite.less
Last active September 26, 2017 12:43 — forked from jayj/flexbox.less
CSS3 Flexbox - LESS Mixins
.flex-display(@display: flex) {
display: @display;
}
.flex(@columns: initial) {
flex: @columns;
}
.flex-direction(@direction: row) {
flex-direction: @direction;
@MHM5000
MHM5000 / django_install_apache.md
Created February 12, 2017 15:34 — forked from fduran/django_install_apache.md
Django Install - Apache

Django Install - Apache

Once per server:

apt-get update && apt-get upgrade
apt-get install libapache2-mod-wsgi
apt-get install python-setuptools python-dev build-essential
easy_install -U pip

@MHM5000
MHM5000 / emoji_test.rb
Created November 30, 2015 13:38 — forked from holman/emoji_test.rb
A snapshot of the tests we use internally at GitHub to help edit our blog posts before they go out to everybody. For more information, take a peek at http://zachholman.com/posts/how-github-writes-blog-posts
require_relative "test_helper"
require "open-uri"
require "net/http"
class EmojiTest < Blog::Test
def test_no_emoji
posts.each do |post|
content = File.read(post)
refute_match /:[a-zA-Z0-9_]+:/, content,
#rtl-support .tt-dropdown-menu {
text-align: right;
}