Skip to content

Instantly share code, notes, and snippets.

View jerinisready's full-sized avatar
💭
A catalyst of Change

JK jerinisready

💭
A catalyst of Change
View GitHub Profile
@jerinisready
jerinisready / my_neighbouring_ips.py
Last active March 20, 2019 08:06
Get all neighbouring Active IP Addressess.
# COURTSY: https://stackoverflow.com/a/48607794/6419332
import os
import socket
import multiprocessing
import subprocess
import os
def pinger(job_q, results_q):
DEVNULL = open(os.devnull, 'w')
@jerinisready
jerinisready / read_more_read_less.html
Created March 19, 2019 16:18
Read More Read Less allows a js based read more and read less.
<!doctype html>
<head>
<title>read_more_read_less.html</title>
</head>
<body>
<style>
.testimonial-item blockquote{font-size: small;}
.moretext {display: none;}
.moreless-button{color: #fc5c7d;}
.testimonial-item q{line-height: 1.8em; quotes: '“' '“'}
@jerinisready
jerinisready / auto_register_django_admin.py
Created March 12, 2019 09:47
Register at Django Admin `_registry` for all unregistered models in an app.
"""
Register at Django Admin `_registry` for all unregistered models in an app. this file replaces `admin.py` file in model
"""
__author__: str = "jerinisready"
__description__: str = "Django Model Admin Collection over admin.py"
__version__: str = "v0.1"
admin_imports = ('Brand', 'Category', 'Classification', 'Collection', 'ProductVariant', 'ProductVariantDetail',
'Product', 'Merchant', 'Variant', 'VariantValue')
LOGIN PAGES.
https://bootsnipp.com/snippets/92gmX
https://bootsnipp.com/snippets/z8aQr
https://bootsnipp.com/snippets/dldxB
https://bootsnipp.com/snippets/8b7n # paytm like login
@jerinisready
jerinisready / resources.py
Created March 7, 2019 12:07
This is how to Create some Dynamic modules in a package. this snipopets is from a django project which uses DJANGO-IMPORT-EXPORT. I wrote a `resources.py` file so that
import sys
from types import ModuleType
from django.apps import apps
from django.contrib.auth import get_user_model
from import_export import resources
admin_imports = 'Brand, Category, Classification, Merchant, Variant, VariantValue'.split(', ') # name of my db modules.
dynamic_module = ModuleType(__name__) # module Generator.
@jerinisready
jerinisready / nginx.conf
Created March 6, 2019 11:32 — forked from leandromoreira/nginx.conf
nginx.conf optmized for http/2 = HTTPS TLS (ssl)
# command to generate dhparams.pen
# openssl dhparam -out /etc/nginx/conf.d/dhparams.pem 2048
limit_conn_zone $binary_remote_addr zone=conn_limit_per_ip:10m;
limit_req_zone $binary_remote_addr zone=req_limit_per_ip:10m rate=5r/s;
limit_req_status 444;
limit_conn_status 503;
proxy_cache_path /var/lib/nginx/proxy levels=1:2 keys_zone=backcache:8m max_size=50m;
proxy_cache_key "$scheme$request_method$host$request_uri$is_args$args";
@jerinisready
jerinisready / deploy_django.sh
Created March 6, 2019 07:28
A deployment Script to Manua Deploy django with gunicorn and nginx
VIRTUALENV_ACTIVATEFILE_PATH="/home/ubuntu/venv/project_env/bin/activate"
DJANGO_PROJECT_ROOT="/var/www/example.com/arkk/"
DEPLOY_BRANCH="develop"
STATIC_DIR="assets"
echo_red(){
echo -e "\e[1;31m$1\e[0m"
}
@jerinisready
jerinisready / django_get_all_urls.py
Last active March 12, 2019 09:17
This is How to get Django urls Recersively. [This script requires python>="v3.3" ]
#!/usr/bun/python3.6
from django.urls import URLPattern, URLResolver
from django.conf import settings
urlconf = __import__(settings.ROOT_URLCONF, {}, {}, ['']) # load base url conf from settings.
def _get_all_urls(init_resolver, root: str = None) -> tuple:
"""
@jerinisready
jerinisready / rainbow_coloured_text.css
Created December 15, 2018 07:21
Create Your Own Text Effects. Here Given A Rainbow Type Text effect.
/**
Generated Background Style @ : https://www.cssmatic.com/gradient-generator#
You Can Genertate Some awesome Gradient There. These are Backgrounds.
If You want to mask it to your text so that your text seems colorful. Use this additional css
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
DEMO @ CODEPEN : https://codepen.io/jerinisready/pen/PXNOWM
*/
@jerinisready
jerinisready / ToastJS.md
Last active December 13, 2018 08:06
Toast.JS Create Android like Toast with Customizable Styles and actions!! Popup Messages as much as you want! *** On Pure Native JS! ***

Create Android like Toast

Dependancies Javascript

with Customizable Styles and actions!!

Now Popup Messages as much as you want! Document will be followed!

Pure Javascript Without any Dependencies!

Usage :