Skip to content

Instantly share code, notes, and snippets.

View ahmadalsajid's full-sized avatar

Ahmad Al-Sajid ahmadalsajid

  • Dhaka, Bangladesh
View GitHub Profile
@ahmadalsajid
ahmadalsajid / setup_docker_es_kibana.sh
Created December 22, 2020 15:19
This script will install Docker on your Ubuntu machine, pull docker images of Elasticsearch and Kibana, run the containers with the names **local_es** and **local_kibana** respectively. You have to download this file and make it executable, i.e. ``` $ sudo chmod +x setup_docker_es_kibana.sh ``` Now, execute the script. i.e. ``` $ ./setup_docker_…
sudo apt remove docker docker-engine docker.io containerd runc
sudo apt update -y
sudo apt install \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
@ahmadalsajid
ahmadalsajid / kibana.conf
Last active May 5, 2020 11:10
Nginx configuration for authenticating user for ElasticSearch and Kibana
upstream elasticsearch {
server 127.0.0.1:9200;
keepalive 15;
}
upstream kibana {
server 127.0.0.1:5601;
keepalive 15;
from celery import Celery
from celery.schedules import crontab
import MySQLdb
import random
import string
import time
app = Celery('db_update', broker="pyamqp://guest@localhost//")
# disable UTC to use local time
app.conf.enable_utc = False
[Unit]
Description=Celery Service
After=network.target
[Service]
Type=simple
User=sajid
Group=sajid
EnvironmentFile=/etc/default/celeryd
WorkingDirectory=/home/sajid/Projects/simple-celery
[Unit]
Description=Celery Service
After=network.target
[Service]
Type=forking
User=sajid
Group=sajid
EnvironmentFile=/etc/default/celeryd
WorkingDirectory=/home/sajid/Projects/simple-celery
# The names of the workers. This example create one worker
CELERYD_NODES="worker1"
# The name of the Celery App, should be the same as the python file
# where the Celery tasks are defined
CELERY_APP="db_update"
# Log and PID directories
CELERYD_LOG_FILE="/var/log/celery/%n%I.log"
CELERYD_PID_FILE="/var/run/celery/%n.pid"
from celery import Celery
from celery.schedules import crontab
import MySQLdb
app = Celery('db_update', broker="pyamqp://guest@localhost//")
# disable UTC to use local time
app.conf.enable_utc = False
@ahmadalsajid
ahmadalsajid / httpd_vhosts.conf
Last active June 22, 2019 07:49
mod_wsgi-express module-config
# virtual my_project
<VirtualHost *:80>
ServerName localhost
WSGIPassAuthorization On
ErrorLog "C:/Users/Administrator/Desktop/my_project/my_project.error.log"
CustomLog "C:/Users/Administrator/Desktop/my_project/my_project.access.log" combined
WSGIScriptAlias / "C:/Users/Administrator/Desktop/my_project/my_project/wsgi_windows.py"
<Directory "C:/Users/Administrator/Desktop/my_project/my_project">
<Files wsgi_windows.py>
Require all granted
@ahmadalsajid
ahmadalsajid / module-config.txt
Last active May 21, 2019 10:16
mod_wsgi-express module-config
LoadFile "c:/Program Files/python/python36/python36.dll"
LoadModule wsgi_module "c:/Program Files/python36/lib/site-packages/mod_wsgi/server/mod_wsgi.cp36-win_amd64.pyd"
WSGIPythonHome "c:/Program Files/python/python36"
@ahmadalsajid
ahmadalsajid / wsgi_windows.py
Last active May 30, 2019 07:20
mod_wsgi with apache to serve Django application on windows server
import os
import sys
import site
from django.core.wsgi import get_wsgi_application
# add python site packages, you can use virtualenvs also
site.addsitedir("C:/Program files/python36/Lib/site-packages")
# Add the app's directory to the PYTHONPATH
sys.path.append('C:/Users/Administrator/Desktop/my_project')