Skip to content

Instantly share code, notes, and snippets.

View saiyerniakhil's full-sized avatar
🐲
Hustling

Akhil saiyerniakhil

🐲
Hustling
View GitHub Profile
@saiyerniakhil
saiyerniakhil / qsortAndBsearch.c
Created August 8, 2019 13:41
A sample c program to demonstrare qsort and bsearch from stdlib in c language
#include<stdlib.h>
int compare(const void * a, const void * b) {
return (*(int*)a- *(int*)b);
}
int main() {
int n,k=21;
scanf("%d",&n);
@saiyerniakhil
saiyerniakhil / spiral.c
Created August 8, 2019 13:29
A C program to print a matrix as a spiral form
#include <stdio.h>
#include<stdlib.h>
/*
Sample Input: 5
Sample Output:
1 2 3 4 5
17 18 19 20 6
26 27 28 21 7
14 24 23 22 8
@saiyerniakhil
saiyerniakhil / diamond_pattern.py
Created August 2, 2019 12:34
Python program to print a diamond to the console
import sys
n = 10
space = n-1
for i in range(n):
for j in range(space+1):
sys.stdout.write(" ")
for k in range(i):
sys.stdout.write("* ")
space -= 1
sys.stdout.write("\n")
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([])
@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 = ()=> {
<!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.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():
@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 14:26
A Flask Hello World! App
from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
@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 = [",",".",":","?","!"]