Skip to content

Instantly share code, notes, and snippets.

View SingAvi's full-sized avatar
💻
Practice and Master

Avinash Singh SingAvi

💻
Practice and Master
View GitHub Profile
@SingAvi
SingAvi / Ping.py
Created July 10, 2017 17:53
To ping the ip address of devices connected to a particular wireless system.
import subprocess
for ping in range(1,10):
address = "127.0.0." + str(ping)
res = subprocess.call(['ping', '-c', '3', address])
if res == 0:
print ("ping to", address, "OK")
elif res == 2:
print ("no response from", address)
@SingAvi
SingAvi / itemScrape.py
Last active May 6, 2018 01:55
Scraped through all the data of a web page and stored it into a csv file
from bs4 import BeautifulSoup as soup
from urllib.request import urlopen as uReq
my_Url = ("http://agmarknet.gov.in/agnew/namticker.aspx")
Client = uReq(my_Url)
html = Client.read()
Client.close()
userDatabase.addValueEventListener(new ValueEventListener() {
@Override
public void onDataChange(DataSnapshot dataSnapshot)
{
String name =dataSnapshot.child("name").getValue().toString();
String status =dataSnapshot.child("status").getValue().toString();
String image =dataSnapshot.child("image").getValue().toString();
String thumb_image =dataSnapshot.child("thumbnail").getValue().toString();
import PyPDF2
newFile - open('x.pdf','r')
pdfreader = PyPDF2.PdfFileReader(newFile)
print(pdfreader.getNumPages())
pageObj = pdfreader.getPage(0)
x = pageObj.extractText()
print(x)
@SingAvi
SingAvi / firstDuplicate.py
Last active February 25, 2020 08:45
Find First Duplicate In The Array
arr = [4,6,9,2,5,4,6,8,9]
seenSet = set()
def firstDuplicate(a):
for i in a:
if i in seenSet:
return i
else:
seenSet.add(i)
return -1
@SingAvi
SingAvi / firstNonRepeatChar.py
Created February 25, 2020 16:13
First Non Repeating Character
def firstNotRepeatingCharacter(s):
charArray = []
charCount = {}
for i in s:
if i in charCount:
charCount[i] +=1
else:
charCount[i] = 1
charArray.append(i)
@SingAvi
SingAvi / anagram.py
Created March 26, 2020 14:26
Anagram = Two Words of consisting same letters but diff word orientation
def AnagramCheck(s1,s2):
 if(sorted(s1.lower())== sorted(s2.lower())):
 print("Anagram")
 else:
 print("Not An Anagram")
s1 = input("String 1: ")
s2 = input("String 2: ")
print(AnagramCheck(s1,s2))
@SingAvi
SingAvi / getFacts.py
Created April 24, 2020 07:05
Extracting Facts from a datasets of information
import wikipedia
import spacy
import textacy.extract
# f= open("facts.txt","a+")
# Load the large English NLP model
nlp = spacy.load('en_core_web_sm')
# Detail of the searched word
content =wikipedia.page("Apple Inc").content
@SingAvi
SingAvi / facts.txt
Last active April 24, 2020 07:16
Get Facts Output
Here are the things I know about Apple:
-well known for its size and revenues
-the world's largest technology company by revenue and one of the world's most valuable companies
-a distant third place competitor to Commodore and Tandy
-only weeks away from bankruptcy when Jobs returned.
-the third-largest mobile handset supplier in the world due to the popularity of the iPhone
-a sign for the “promise of knowledge” that an Apple user may gain from the product.
-more than just a company because its founding has some of the qualities of myth
-a marketing company
@SingAvi
SingAvi / gist:64ad75a9b06308083de7d5dfdc31a9c9
Created August 13, 2020 08:48
Capture Image And Get Uri
Step 1:
# implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
Step 2 :
# <activity
android:name="com.theartofdev.edmodo.cropper.CropImageActivity"
android:theme="@style/Base.Theme.AppCompat" />
Step 3 :