Skip to content

Instantly share code, notes, and snippets.

View bharatrsharma's full-sized avatar

Bharat bharatrsharma

View GitHub Profile
@bharatrsharma
bharatrsharma / gist:0a5e327b7f26744540185dcc5eb8629e
Last active May 21, 2020 09:55
Usefule command for python
-- upgrade python from command prompt
python -m pip install --upgrade pip
-- to check for version
pip --version
--To downgrade the PIP version to 18.1 or any other version, type following command, and then press Enter:
python -m pip install pip==18.1
@bharatrsharma
bharatrsharma / sendMail.py
Created May 14, 2020 08:36
Mail Send Using Python
import smtplib
from email.header import Header
from email.mime.text import MIMEText
class PythonEmail:
_163='163'
SINA='SINA'
QQ='QQ'
SMTP_QQ='smtp.qq.com'
SMTP_163='smtp.163.com'
@bharatrsharma
bharatrsharma / Posgres.util.sql
Last active January 31, 2019 06:39
Postgres
-- Checking Postgres Version via PSQL
select version();
$ psql --version
-- Show Data Directory
SHOW data_directory;
@bharatrsharma
bharatrsharma / upgrade-postgres-9.4-to-9.5-to-9.6-to-10.md
Created January 3, 2019 15:42 — forked from Komzpa/upgrade-postgres-9.4-to-9.5-to-9.6-to-10.md
Upgrading PostgreSQL from 9.4 to 9.5 to 9.6 to 10 when upgrading Ubuntu 14.10 to 16.04

TL;DR

9.4 -> 9.5:

sudo pg_dropcluster 9.5 main --stop
sudo service postgresql stop
sudo pg_upgradecluster -m upgrade -k 9.4 main
sudo su postgres -c "/usr/lib/postgresql/9.5/bin/vacuumdb --all --analyze-in-stages"
sudo pg_dropcluster 9.4 main
@bharatrsharma
bharatrsharma / Python Books.md
Created December 13, 2018 12:55
Python Books

This is a collection of books that I've researched, scanned the TOCs of, and am currently working through.  The books are selected based on quality of content, reviews, and reccommendations of various 'best of' lists.

The goal of this collection is to promote mastery of generally applicable programming concepts.

Most topics are covered with Python as the primary language due to its conciseness, which is ideal for learning & practicing new concepts with minimal syntactic boilerplate.

JavaScript & Kotlin are listed in the Tooling section; as they allow extension of VS Code and the IntelliJ suite of IDEs, which cover most development needs.

 

@bharatrsharma
bharatrsharma / postgres_queries_and_commands.sql
Created April 3, 2018 08:03 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- 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%'
@bharatrsharma
bharatrsharma / intro.md
Last active June 3, 2021 14:06 — forked from derhuerst/intro.md
Installing Git on Linux, Mac OS X and Windows
*/15 0-23 * * * /opt/gst-deploye/gst.rollout.folderbackup.sh
*/59 21 * * * /opt/gst-deploye/gst.rollout.fullbackup.sh
#!/usr/bin/env bash
set -e
# Configure these as needed
DIRECTORY="/opt/gst-deploye/"
ARCHIVE_PATH="/home/usradmin/archived.gst.rollout/gst_fullbackup/"
DATE=$(date +"%d.%m.%Y_%H%M")
ARCHIVE_FILE="$(hostname)_$DATE.tgz"
HOST='192.168.6.73'
USER='admin'
@bharatrsharma
bharatrsharma / CSV.java
Created May 24, 2017 03:11 — forked from jaysridhar/CSV.java
Java CSV Reader module. Drop into any project and use. Supports Excel compatible CSV (multi-line columns, etc).
package sample;
import java.io.InputStream;
import java.io.PushbackInputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.BufferedReader;
import java.util.List;
import java.util.ArrayList;