Skip to content

Instantly share code, notes, and snippets.

@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 / windows-host-linux-guest-virtualbox-increase-vdi-fixed-size.md
Created May 13, 2020 06:17
Increase an Ubuntu/Linux virtualbox fixed size viratual disk image (guest) on a Windows 10 (host)

Disclaimer: I just did these steps once after 2 hours of research on a VirtualBox Version 6.0.10 r132072 (Qt5.6.2) installed on Windows 10 and it worked. Make sure you know what you are doing.

Let's assume these:

  • Your VM VirtualBox installation folder is: C:\Program Files\Oracle\VirtualBox
  • Your VM files are in D:\VM\ubuntu\18.04\.
  • fixed-18.04.vdi is a 40GB fixed size storage that we want to resize.

Steps:

  1. Shutdown your Ubuntu VM.
@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 / maltrail.md
Last active September 14, 2019 09:14
sudo apt-get install python3 python-dev python3-dev \
    build-essential libssl-dev libffi-dev \
    libxml2-dev libxslt1-dev zlib1g-dev \
    libpcap-dev libpq-dev
@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
def send_request_webgate(amount, description, email, mobile, additional_data=''):
client = Client(WSDL_URL)
if additional_data:
result = client.service.PaymentRequestWithExtra(
ZARINPAL_MERCAHNTID,
amount,
description,
additional_data,
email,
mobile,
@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 / BSG-Watch-order.md
Last active October 6, 2024 07:57
Battlestar Galactica watch order

Source 1 Source 2

به ترتیب ساخت و پخش

Production Order

The show's production order is probably the best viewing order as well, since this is the order the series originally aired in and is what most people viewed the series in. This also best protects later spoilers and crucial plot revelations.