Skip to content

Instantly share code, notes, and snippets.

View skysoft999's full-sized avatar
🎯
Focusing

Sanu k yadav skysoft999

🎯
Focusing
View GitHub Profile
@skysoft999
skysoft999 / python_decorator_guide.md
Created January 3, 2019 08:40 — forked from Zearin/python_decorator_guide.md
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@skysoft999
skysoft999 / asciidecodeerror.py
Created November 2, 2018 18:55 — forked from miraculixx/asciidecodeerror.py
Tired of Python's UnicodeDeocodeError, ascii codec can't decode? Here's how to fix it, once and for all.
# Python ascii codec can't decode and unicode mess
#
# check this out https://pythonhosted.org/kitchen/unicode-frustrations.html
# and this http://www.joelonsoftware.com/articles/Unicode.html
#
# The short of it is this
# 1. If you can, always set PYTHONIOENCODING=utf8 before you start your python programs.
# 2. If you can't or you can't ensure this, always use the following lambda _u to get unicode text
# whereever you convert to strings (str.format, str % etc.)
#
@skysoft999
skysoft999 / git commands.txt
Created October 12, 2018 07:45 — forked from kmorcinek/git commands.txt
Git Commands. My common scenarios for using git.
# good git book
http://git-scm.com/book
# Discard uncommitted changes in a specific file
git checkout file_name
# Clear everything not in repo
git checkout -- .
# A way to quickly move to the previous commit in a git branch. This also way for "deleting" last commit.
@skysoft999
skysoft999 / windows_task_scheduler.py
Created April 26, 2018 09:20 — forked from nmpowell/windows_task_scheduler.py
Python script to interact with existing Windows Task Scheduler tasks.
"""
Python script to interact with existing Windows Task Scheduler tasks.
CLI usage:
python windows_task_scheduler.py {enable|disable|run} -t "TaskName"
import usage:
import windows_task_scheduler as wts
wts.enable_task(task_name='TaskName')
wts.disable_task(task_name='TaskName')