Skip to content

Instantly share code, notes, and snippets.

View neerajvashistha's full-sized avatar
🏠
Working from home

Neeraj Vashistha neerajvashistha

🏠
Working from home
View GitHub Profile
#!/bin/sh
max=90
while true
do
battery_percentage=`acpi -b | egrep 'Charging|Full'|grep -v 'Discharging' | grep -P -o '[0-9]+(?=%)'`;
if [ "$battery_percentage" -gt "$max" ]
then
echo $battery_percentage
notify-send 'Laptop Battery Charged' "Please Disconnect Laptop Battery is charged"

sudo apt-get update sudo apt-get upgrade ubuntu-drivers devices sudo ubuntu-drivers autoinstall

@neerajvashistha
neerajvashistha / temp-indicator.py
Created November 22, 2019 00:23 — forked from atilberk/temp-indicator.py
An CPU/GPU temperature indicator in for Ubuntu
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# I am using this to monitor my cpu's temperature in the top bar of my os
# I have tested the script on Ubuntu 15.10 with Python 2.7.10
# Update: I used to require acpi but then found a simpler way
import sys,time,re,commands,os
from gi.repository import Gtk, GLib
@neerajvashistha
neerajvashistha / sp
Last active November 21, 2019 15:47 — forked from duncan-bayne/sp
sp is a command-line client for Spotify's dbus interface. Play, pause, skip and search tracks from the comfort of your command line.
#!/bin/bash
#
# This is sp, the command-line Spotify controller. It talks to a running
# instance of the Spotify Linux client over dbus, providing an interface not
# unlike mpc.
#
# Put differently, it allows you to control Spotify without leaving the comfort
# of your command line, and without a custom client or Premium subscription.
#
absl-py==0.7.1
astor==0.8.0
atomicwrites==1.3.0
attrs==19.3.0
backcall==0.1.0
beautifulsoup4==4.8.1
bleach==3.1.0
blis==0.4.1
boto==2.49.0
boto3==1.10.0
@neerajvashistha
neerajvashistha / gbp-inr-indicator.py
Last active November 4, 2019 05:14 — forked from caiosba/dollar-reais-indicator.py
Ubuntu Unity Indicator to show current gbp value in indian rupee (auto-updates every minute)
#!/usr/bin/env python
# Unity indicator for dolar/real currency
# Author: Caio Almeida <caiosba@gmail.com>
# 05 Jul 2016
import gobject
import gtk
import appindicator
import os, sys
import time
@neerajvashistha
neerajvashistha / waya-dl-setup.sh
Created May 15, 2019 06:28 — forked from mjdietzx/waya-dl-setup.sh
Install CUDA Toolkit v8.0 and cuDNN v6.0 on Ubuntu 16.04
#!/bin/bash
# install CUDA Toolkit v8.0
# instructions from https://developer.nvidia.com/cuda-downloads (linux -> x86_64 -> Ubuntu -> 16.04 -> deb (network))
CUDA_REPO_PKG="cuda-repo-ubuntu1604_8.0.61-1_amd64.deb"
wget http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1604/x86_64/${CUDA_REPO_PKG}
sudo dpkg -i ${CUDA_REPO_PKG}
sudo apt-get update
sudo apt-get -y install cuda
# Requirements
# certifi==2018.11.29
# chardet==3.0.4
# datefinder==0.6.1
# EasyProcess==0.2.5
# emoji==0.5.1
# idna==2.8
# nltk==3.4
# pendulum==2.0.4
# PySocks==1.6.8
import re
import datetime
import pendulum
import datefinder
def review_date_cal(sentence):
date_value = "NAN"
now = pendulum.now()
if 'ago' in sentence:
if 'day' in sentence:
value = " ".join(re.findall("[0-9]+", sentence))
import cv2
#reading the image
image = cv2.imread("000001.jpg")
edged = cv2.Canny(image, 10, 250)
#cv2.imshow("Edges", edged)
#cv2.waitKey(0)
#applying closing function
kernel = cv2.getStructuringElement(cv2.MORPH_RECT, (30, 30))
closed = cv2.morphologyEx(edged, cv2.MORPH_CLOSE, kernel)