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
services = {
"food":
{
"chinese":
[
"chowmein",
"manchurian",
"hot and sour soup",
"spring rolls",
"dumplings or momos",
import telepot, time
from nltk.chat.iesha import iesha_chatbot
import phrase_extract
import service_prov_db_handle
import sys
import telepot, time
from geopy.geocoders import Nominatim
is_chatting = False
@neerajvashistha
neerajvashistha / service_prov_db_handle.py
Last active March 3, 2016 18:28
pymongo collection creation, load JSON, query MongoDB
import json
import pymongo
import serv_decrp
import phrase_extract
from pymongo import MongoClient
def main():
load_JSON_into_Collection("services.json","service_type")
#loc_serv_list = queryServNameLocation(qryd_serv_prvd_list,"Khadi Machine")
from __future__ import absolute_import
from __future__ import print_function
import six
import rake
import operator
import io
import spellcheck
import re, collections
import enchant
from enchant.checker import SpellChecker
def words(text):
return re.findall('[a-z]+', text.lower())
def train(features):
model = collections.defaultdict(lambda: 1)
for f in features:
@neerajvashistha
neerajvashistha / services.json
Last active March 6, 2016 18:44
service provider/vendors json file for db creation
{ "service_type":
[
{ "food":
[
{ "type":"chinese","serv_prvd":
[
{ "serv_name":"Rolls Delight","serv_loc":"katraj","phone":919673637284},
{ "serv_name":"Chinese Corner","serv_loc":"katraj","phone":919673637284},
{ "serv_name":"China point","serv_loc":"khadi machine","phone":919673637284}
]

A1 binary search

code

import random
def binarySearch(alist, searchelement):
	'''
	binartsearch using divide and conqure(non-recursive).

	    @param: alist, unsorted list
	    @param: item, an element to be searched in alist
#!/usr/bin/env bash
s=$(date +%s | cut -b1-13)
while true
do
export DISPLAY=:0.0
battery_percent=$(acpi -b | grep -P -o '[0-9]+(?=%)')
if on_ac_power; then
if [ "$battery_percent" -gt 90 ]; then
s=$(date +%s | cut -b1-13)
notify-send -i notification-power-disconnected -t 6000 "Battery full." "Level: ${battery_percent}% "
fname=`date +"%d.%m.%Y_%H:%M:%S_%P"`.'_screencast.mp4'
input_width=320 # preselect width an height of video source
input_height=240 # other possible combinations: 640/480; 320/240
ASPECT=43 # '169' (16:9) or '43' (4:3); this value affects video playback with mplayer or vlc only!
V_NORM="pal" # preselect TV-norm 'PAL' oder 'NTSC'
DEV_VIDEO="/dev/video0"
zenity --question --text "Record Webcam video(if NO, Screencast only)?"
if [ "$?" != 0 ]; then #1
vlc screen:// :screen-fps=20 :screen-follow-mouse :live-caching=300 :input-slave=alsa://hw:1,0 :sout="#transcode{vcodec=h264,vb=384,fps=5,acodec=mpga}:duplicate{dst=std{mux=mp4,access=file,dst='$fname'}}" &
fname=`date +"%d.%m.%Y_%H:%M:%S_%P"`.'_screencast.mp4'
input_width=320 # preselect width an height of video source
input_height=240 # other possible combinations: 640/480; 320/240
ASPECT=43 # '169' (16:9) or '43' (4:3); this value affects video playback with mplayer or vlc only!
V_NORM="pal" # preselect TV-norm 'PAL' oder 'NTSC'
DEV_VIDEO="/dev/video0"
title="Select Recording Type"
INPUT=`zenity --width=710 --height=350 --title="$title" --list --radiolist --column="Choice" \
--column="Mode" --column="Description" \
TRUE "0" "Screen Recording + audio from default speakers" \