Skip to content

Instantly share code, notes, and snippets.

View kumaraswins's full-sized avatar
🎯
Focusing

AswinKumar kumaraswins

🎯
Focusing
View GitHub Profile
@kumaraswins
kumaraswins / README.md
Last active June 21, 2019 05:53
PSQL
# Setting PATH for Python 3.7
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH
if [ -f $(brew --prefix)/etc/bash_completion ]; then
. $(brew --prefix)/etc/bash_completion
fi
@kumaraswins
kumaraswins / mac_plugin_essentials
Last active March 19, 2019 10:39
mac essentials
home brew - /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
git brew instal git
ffmpeg git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
libv brew install libav
youtubedl brew install youtube-dl
@kumaraswins
kumaraswins / Django tricks
Last active June 4, 2019 11:25
Django tricks
To get the number of value in the each column with the count
# =========================================================================================================== #
ModelName.objects.filter(id=model.id).all().values('fieldName').annotate(count=Count('fieldName')).order_by()
class ModelNameSerializers(serializers.ModelSerializer):
column_count = serializers.SerializerMethodField()
class Meta:
model = models.ModelName
server {
listen 80;
server_name {{ ip address }};
access_log /var/log/nginx/access.log;
location = /favicon.ico { access_log off; log_not_found off; }
location /static/ {
root /home/ubuntu/projectName/;
}
@kumaraswins
kumaraswins / Gunicorn
Created May 31, 2019 06:42
Gunicorn config
[Unit]
Description=mitron gunicorn daemon
After=network.target
[Service]
PIDFile=/run/gunicorn/pid
User={{ user }}
Group={{ user }}
RuntimeDirectory=gunicorn
WorkingDirectory={{ project_root }}
worker_processes
A worker process is a single-threaded process.
If Nginx is doing CPU-intensive work such as SSL or gzipping and you have 2 or more CPUs/cores,
then you may set worker_processes to be equal to the number of CPUs or cores.
If you are serving a lot of static files and the total size of the files is bigger than the available memory,
then you may increase worker_processes to fully utilize disk bandwidth.
@kumaraswins
kumaraswins / staus code django
Created June 17, 2019 10:56
Django satus code
Informational - 1xx
HTTP_100_CONTINUE
HTTP_101_SWITCHING_PROTOCOLS
Successful - 2xx
HTTP_200_OK
HTTP_201_CREATED
HTTP_202_ACCEPTED
@kumaraswins
kumaraswins / get_bm_ip
Created December 27, 2019 12:43
Get the VM ip address pythonic way
curl http://checkip.amazonaws.com
import requests
requests.get('http://checkip.amazonaws.com').text.rstrip()
@kumaraswins
kumaraswins / gitignore_node.txt
Created December 31, 2019 14:42
node js gitignore mac files
##########################
# Application specfic
##########################
# config/config.js
##########################
# General
##########################
#####