This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#.# Better Git Logs. | |
### Using EMOJI-LOG (https://github.com/ahmadawais/Emoji-Log). | |
# Git Commit, Add all and Push — in one step. | |
function gcap() { | |
git add . && git commit -m "$*" && git push | |
} | |
# NEW. | |
function gnew() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Git Commit, Add all and Push — in one step. | |
cap = "!f() { git add .; git commit -m \"$@\"; git push; }; f" | |
# NEW. | |
new = "!f() { git cap \"📦 NEW: $@\"; }; f" | |
# IMPROVE. | |
imp = "!f() { git cap \"👌 IMPROVE: $@\"; }; f" | |
# FIX. | |
fix = "!f() { git cap \"🐛 FIX: $@\"; }; f" | |
# RELEASE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
# Proto message | |
service { | |
rpc GetTodo(Todo) returns (Todo) {} | |
} | |
message Todo { | |
int64 id = 1; | |
string text = 2; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Logging settings for django projects, works with django 1.5+ | |
# If DEBUG=True, all logs (including django logs) will be | |
# written to console and to debug_file. | |
# If DEBUG=False, logs with level INFO or higher will be | |
# saved to production_file. | |
# Logging usage described below: | |
# import logging | |
# logger = logging.getLogger(__name__) | |
# logger.info("Log this message") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- show running queries (pre 9.2) | |
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query | |
FROM pg_stat_activity | |
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%' | |
ORDER BY query_start desc; | |
-- show running queries (9.2) | |
SELECT pid, age(query_start, clock_timestamp()), usename, query | |
FROM pg_stat_activity | |
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Byte-compiled / optimized / DLL files | |
__pycache__/ | |
*.py[cod] | |
*$py.class | |
# C extensions | |
*.so | |
# Distribution / packaging | |
.Python |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# find -name "* *" -type f | rename 's/ /_/g' # to remove spaces in the directory | |
import glob | |
import os | |
import shutil | |
lectures_string = """\nSection: 1 0 / 5\nWelcome to Try Django 1.11\n\n 1. Welcome to Try Django 1.11 3:53\n 2. Walkthrough 3:51\n 3. Getting Started with Django 24:08\n 4. For your Reference 2:36\n 5. What Django Does 10:35\n\nSection: 2 0 / 8\nHTML & Django\n\n 6. Rendering HTML 4:44\n 7. Render a Django Template 9:13\n 8. Context in Django Templates 9:17\n 9. Template Inheritance 13:59\n 10. Include Template Tag 6:04\n 11. Reactivate Virtualenv 1:10\n 12. Class Based Views 8:26\n 13. Template View 7:29\n\nSection: 3 0 / 8\nRemembering Things\n\n 14. Remembering things with Models 11:03\n 15. More on Model Fields 8:59\n 16. Displaying Saved Data 9:47\n 17. Understanding QuerySets 9:14\n 18. Generic List View 8:58\n 19. Restaurant Profile Detail 10:15\n 20. SlugField & Unique Slug Generator 7:01\n 21. Signal for Unique Slug 6:3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# LANGUAGE: Python3 | |
# AUTHOR: Mahendra Yadav | |
CURSOR_UP = '\033[F' | |
ERASE_LINE = '\033[K' | |
prinnt("Length of dict1 = {}".format(len(dict1))) | |
prinnt("Length of dict2 = {}".format(len(dict2))) | |
# To find the difference between the keys use dict1.keys() - dict2.keys() | |
for key in dict1: | |
print(key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Setting up virtualenv | |
virtualenv env | |
2. activate it using: | |
source ./env/bin/activate | |
3. pip install airflow # will install airflow version 1.8 to use latest one use: pip install apache-airflow | |
4. Add "export AIRFLOW_HOME=~/<directory>" to your bashrc/zshrc | |
echo "export AIRFLOW_HOME=/home/mahendra/pyconf/app_airflow" >> .zshrc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from airflow import DAG | |
from airflow.operators.bash_operator import BashOperator | |
from airflow.operators.python_operator import PythonOperator | |
from airflow.operators.email_operator import EmailOperator | |
from datetime import timedelta, datetime | |
from airflow.models import Variable | |
import xml.etree.ElementTree as ET | |
import glob | |
default_args = { |