Skip to content

Instantly share code, notes, and snippets.

View toransahu's full-sized avatar
💭
I may be slow to respond.

Toran Sahu toransahu

💭
I may be slow to respond.
View GitHub Profile
@toransahu
toransahu / PythonFileTemplate.py
Last active October 31, 2018 09:43
PyCharm File & Live Templates
#set( $LICENSE = "AGPL" )
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# created_on: ${YEAR}-${MONTH}-${DAY} ${HOUR}:${MINUTE}
"""
${NAME}.py
"""
@toransahu
toransahu / setup.py
Last active August 19, 2018 08:43
Example of Setup.py
"""A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
from os import path
red = '\033[91m'
white = '\033[1;97m'
green = '\033[1;32m'
yellow = '\033[1;33m'
run = '\033[1;97m[~]\033[1;m'
bad = '\033[1;31m[-]\033[1;m'
good = '\033[1;32m[+]\033[1;m'
info = '\033[1;33m[!]\033[1;m'
Development Status :: 1 - Planning
Development Status :: 2 - Pre-Alpha
Development Status :: 3 - Alpha
Development Status :: 4 - Beta
Development Status :: 5 - Production/Stable
Development Status :: 6 - Mature
Development Status :: 7 - Inactive
Environment :: Console
Environment :: Console :: Curses
Environment :: Console :: Framebuffer
@toransahu
toransahu / substring_comarision.sh
Created August 1, 2018 06:56
substring comarision in bash
#! /bin/sh
#
# backup_confs.sh
# Copyright (C) 2018 Toran Sahu <toran.sahu@yahoo.com>
#
# Distributed under terms of the MIT license.
#
. ~/paths.sh
@toransahu
toransahu / VIM_Cheatsheet.md
Last active September 17, 2018 07:07
VIM Cheatsheet

Vim Cheatsheet

Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.

Leader

backslash \

Global x

:help keyword # open help for keyword
@toransahu
toransahu / class_based_func_decorator
Last active August 27, 2018 17:53
Writting & using Decorators in Python
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
# created_on: 2018-08-25 13:01
"""
class_based_func_decorator.py
"""
__author__ = 'Toran Sahu <toran.sahu@yahoo.com>'
#!/bin/sh
if [ "$(hostname)" = mint-ethereal ]; then
echo "something"
elif [ "$HOSTNAME" = mint-ethereal ]; then
echo "something"
fi
#!/bin/sh
my_dir="$(dirname $0")"
"$my_dir/other_script.sh"
@toransahu
toransahu / models.py
Last active May 5, 2023 14:04
Writable Nested Serializers | Multiple Images Upload | DRF
#!/usr/bin/env python3.6.4
# coding="UTF-8"
__author__ = 'Toran Sahu <toran.sahu@yahoo.com>'
__copyright__ = 'Copyright (C) 2018 Ethereal Machines Pvt. Ltd. All rights reserved'
from django.db import models
from os import path
from utils import directory_path_with_id