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
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
services = { | |
"food": | |
{ | |
"chinese": | |
[ | |
"chowmein", | |
"manchurian", | |
"hot and sour soup", | |
"spring rolls", | |
"dumplings or momos", |
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
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 |
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
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") |
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 __future__ import absolute_import | |
from __future__ import print_function | |
import six | |
import rake | |
import operator | |
import io | |
import spellcheck | |
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
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: |
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
{ "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} | |
] |
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
#!/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}% " |
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
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'}}" & |
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
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" \ |
OlderNewer