Skip to content

Instantly share code, notes, and snippets.

View saiyerniakhil's full-sized avatar
🐲
Hustling

Akhil saiyerniakhil

🐲
Hustling
View GitHub Profile
@saiyerniakhil
saiyerniakhil / getting started with BeautifulSoup
Created December 16, 2018 04:13
Sample code for getting all links in a webpage
import requests
from bs4 import BeautifulSoup
linkset = []
page = requests.get('www.wikipedia.org') # The URL is of your choice
soup = BeautifulSoup(page.content, 'html.parser')
linkset = soup.find_all('a')
@saiyerniakhil
saiyerniakhil / app.py
Last active December 16, 2018 09:50
A simple hello world flask app.
from flask import Flask, render_template, request
app = Flask(__name__)
@app.route("/")
def index():
return "<h1>Hello World</h1>"
if __name__ == "__main__":
app.run()
@saiyerniakhil
saiyerniakhil / indiannum.py
Last active December 17, 2018 05:51
Python script to validate indian phone numbers
import re
numregex = re.compile(r'\d\d\d\d\d\d\d\d\d\d')
number = input('enter your num')
arr = re.findall(str(number))
#-----update--------
if (len(arr) != 0):
for i in arr:
print(i)
@saiyerniakhil
saiyerniakhil / scramble.py
Created February 13, 2019 08:13
Scramble
import random
sample = """ The company was also broadcasting the translations live online using a computer-synthesized voice,
instead of the original human interpreters’ voices. Wang took pictures and videos as evidence."""
sample_mod = []
sample_mod = sample.split(" ")
punct = [",",".",":","?","!"]
@saiyerniakhil
saiyerniakhil / app.py
Created March 3, 2019 14:26
A Flask Hello World! App
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
@saiyerniakhil
saiyerniakhil / app.py
Created March 3, 2019 16:32
Adding Routes to a Flask Web app
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World!"
@app.route("/first")
def first():
@saiyerniakhil
saiyerniakhil / app.py
Created March 3, 2019 16:54
An actual flask web app with basic functionalities
from flask import Flask,render_template
app = Flask(__name__)
@app.route("/")
def hello():
return render_template("index.html")
@app.route("/first")
def first():
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Sample</title>
<style>
div#div-1 {
border: 1px solid black;
@saiyerniakhil
saiyerniakhil / app.js
Created June 28, 2019 14:50
useEffect Hook in react
import React,{useState, useEffect} from 'react';
import Note from './components/Note'
import axios from 'axios'
const App = () => {
const [notes,setNotes] = useState([])
const [newNote,setNewNote] = useState('')
const [showAll,setShowAll] = useState(true)
const hook = ()=> {
import React,{useEffect, useState} from 'react';
import axios from 'axios';
// import logo from './logo.svg';
import './App.css';
const App = () => {
const [countriesData,setCountriesData] = useState([])
const [country, setCountry] = useState([])