Skip to content

Instantly share code, notes, and snippets.

View katoozi's full-sized avatar
🏡
Working from home

mohammad katoozi katoozi

🏡
Working from home
  • Tehran, Iran
View GitHub Profile
@katoozi
katoozi / i3-audio.conf
Last active May 27, 2019 07:39
my i3 script for increase, decrease and mute sound
# add this three line to i3 config file
bindsym XF86AudioRaiseVolume exec --no-startup-id ~/.i3/sound_script.sh incr #increase sound volume
bindsym XF86AudioLowerVolume exec --no-startup-id ~/.i3/sound_script.sh decr #decrease sound volume
bindsym XF86AudioMute exec --no-startup-id ~/.i3/sound_script.sh # mute sound
@katoozi
katoozi / google-search.sh
Created April 13, 2019 06:36
my google search script for dmenu
#!/bin/sh
browser=${BROWSER:-google-chrome-stable}
pgrep -x dmenu && exit
choice=$(echo "" | dmenu -i -p "Search Google:") || exit 1
if [ "$choice" = "" ]; then
$browser "https://google.com"
else
@katoozi
katoozi / i3-layout.conf
Last active May 27, 2019 07:40
show current language layout in i3blocks
# add this line to i3 config file
# change us,ir based on your language layout
exec --no-startup-id "setxkbmap -layout us,ir -option 'grp:ctrl_alt_toggle'"
@katoozi
katoozi / i3-network-manager.conf
Last active May 27, 2019 07:40
network manager for i3blocks
#install network-manager-applet with your package manager
exec_always --no-startup-id exec nm-applet etc
@katoozi
katoozi / setup.cfg
Created May 15, 2019 12:06
setup.cfg
[isort]
include_trailing_comma=True
line_length = 79
skip=.git,migrations,__pycache__,settings.py,wsgi.py,test_project,__init__.py,tests
[flake8]
max-line-length = 79
exclude=.git,migrations,__pycache__,settings.py,wsgi.py,test_project,__init__.py,tests
max-complexity=10
@katoozi
katoozi / distribute.sh
Last active May 18, 2019 08:35
distribute django package with one command
#!/bin/bash
python3 setup.py sdist bdist_wheel
twine upload dist/* --verbose
read -p "Delete build/ and dist/ [y/n/n]: " answer
if [ "$answer" = "y" ]
then
rm -d -r build/ dist/
fi
@katoozi
katoozi / setup.py
Last active May 18, 2019 08:44
simple setup.py
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import os
from setuptools import find_packages, setup
version = __import__('package').__version__
here = os.path.abspath(os.path.dirname(__file__))
@katoozi
katoozi / gunicorn.sh
Created May 15, 2019 12:12
simple gunicorn file
#!/bin/bash
NAME="django_project" # Name of the application
DJANGODIR=/var/www/django_project # Django project directory
SOCKFILE=/var/www/django_env/run/gunicorn.sock # we will communicte using this unix socket
USER=root # the user to run as
GROUP=root # the group to run as
NUM_WORKERS=3 # how many worker processes should Gunicorn spawn
DJANGO_SETTINGS_MODULE=django_project.settings # which settings file should Django use
DJANGO_WSGI_MODULE=django_project.wsgi # WSGI module name
@katoozi
katoozi / django_supervisor.conf
Last active May 18, 2019 08:48
simple supervisor service file
[program:django_project]
command = /var/www/django_project/gunicorn_start.sh ; Command to start app
user = ubuntu ; User to run as
stdout_logfile = /var/www/logs/gunicorn_supervisor.log ; Where to write log messages
redirect_stderr = true ; Save stderr in the same log
environment=LANG=en_US.UTF-8,LC_ALL=en_US.UTF-8 ; Set UTF-8 as default encoding
@katoozi
katoozi / config_bind9_steps.txt
Last active May 18, 2019 08:41
config bind9 steps
1: sudo apt-get install bind9 dnsutils -y
2: cd /etc/bind/
3: mkdir zones
4: cp db.local zones/your_domain_name.com
5: nano named.conf.default-zones