Skip to content

Instantly share code, notes, and snippets.

View sameerkumar18's full-sized avatar
☑️
Building

Sameer Kumar sameerkumar18

☑️
Building
View GitHub Profile
/*Ans 1. Create a menu driven program to provide the operations on linear stack: 1. Inserting Elements 2. Removing Elements 3. Display Stack Elements 4. Exit
Programmed By fb.com/sameer18051998*/
#include<iostream.h>
#include<conio.h>
#include<process.h>
int top=-1;
void push(int stack[5])
{
while(top<5)
{
@sameerkumar18
sameerkumar18 / buublesort.cpp
Created November 28, 2015 06:31
WAP to sort an array using Bubble Sort
/*Programmed by www.fb.com/sameer18051998*/
#include<iostream.h>
#include<conio.h>
void BubbleSort(int[],int);
void main()
{clrscr();
int AR[50],elem,n,index;
cout<<"\nWith How Many Elements Do You Want To Create An Array ?\n";
cin>>n;
cout<<"\nEnter The Array Elements\n";
@sameerkumar18
sameerkumar18 / selectionsort.cpp
Created November 28, 2015 06:32
WAP to sort an array using Selection Sort
/*Programmed by www.fb.com/sameer18051998*/
#include<iostream.h>
#include<conio.h>
void main()
{
int i,j,n,loc,temp,min,a[30];
cout<<"Enter the number of elements:";
cin>>n;
cout<<"\nEnter the elements\n";
@sameerkumar18
sameerkumar18 / array.cpp
Last active November 28, 2015 06:37
display array by removing one zero while looping like Output 9654321 9654320 9654300 9654000 9650000
/*Programmed by www.fb.com/sameer18051998*/
#include<iostream.h>
#include<conio.h>
void func(int[] , int);
void main()
{ clrscr();
int m,a1[20];
cout<<"\nEnter The Size Of The Array (Max. 20) \n";
cin>>m;
cout<<"\nEnter The Array \n";
@sameerkumar18
sameerkumar18 / fetch_cbse_result.rb
Created August 17, 2016 14:47 — forked from vparihar01/fetch_cbse_result.rb
this is small script will fecth the results of cbse 12th grade results.
require "uri"
require "net/http"
require "nokogiri"
require "logger"
name_final = Array.new
uri = URI.parse("http://resultsarchives.nic.in/cbseresults/cbseresults2004/class12/cbse12.asp")
req = Net::HTTP::Post.new(uri.path, {
'Referer' => "http://resultsarchives.nic.in/cbseresults/cbseresults2004/class12/cbse12.htm",
@sameerkumar18
sameerkumar18 / random.js
Created May 12, 2017 21:45
This JS basically randomly changes the colour of the div element every time the webpage refreshes. Just made this because I couldn't find this on the internet. To make this run you need to add this to your HTML page "onload="return ran_col()" {For Example - <body onload="return ran_col()">}
function ran_col() { //function name
var color = '#'; // hexadecimal starting symbol
var letters = ['7550FB','ff0000','66ff66','669900','9999ff','3366ff','990099','C0C0C0']; //Set your colors here
color += letters[Math.floor(Math.random() * letters.length)];
document.getElementById('ENTER ELEMENT NAME').style.background = color; // Setting the random color on your div element.
}
@sameerkumar18
sameerkumar18 / example_flask_googlecaptcha.py
Created May 20, 2017 07:04
A Simple Python Flask Example for Google Recaptcha (implemented on http://ipusearch.herokuapp.com)
RECAPTCHA_PUBLIC_KEY = '<public key>'
RECAPTCHA_PRIVATE_KEY = '<private key>'
def checkRecaptcha(response, secretkey):
url = 'https://www.google.com/recaptcha/api/siteverify?'
url = url + 'secret=' + str(secretkey)
url = url + '&response=' +str(response)
@sameerkumar18
sameerkumar18 / instamojo_django_webhook.py
Last active March 6, 2018 14:55
Instamojo Django Webhook
def validate_webhook(request):
data = dict(request.POST.lists())
print(data)
mac_provided = data.pop('mac')[0]
print("mac provided is =")
print(mac_provided)
message = "|".join(v[0] for k, v in sorted(data.items(), key=lambda x: x[0].lower()))
# Pass the 'salt' without the <>. Found in API Integration dashboard
@sameerkumar18
sameerkumar18 / regex_validation.py
Created May 30, 2018 04:42
Self help - Regex Validation
'''
To match Date such as "20-21-2018"
(\d{2})[/.-](\d{2})[/.-](\d{4})$
To match Mobile number such as "9810284901"
^[0][1-9]\d{9}$|^[1-9]\d{9}$
To match a URL
^.*http.*$
'''
import requests
@sameerkumar18
sameerkumar18 / views.py
Created May 12, 2019 15:37
Shopify 429, 5XX and malformed JSON patch
# For handling Shopify 429 - https://gist.github.com/wowkin2/079844c867a1a06ce15ea1e4ffdee87c
def patch_shopify():
connection_func = ShopifyConnection._open
decode_func = formats.JSONFormat.decode
def patch_decode(resource_string):
count_format_error = 0
while count_format_error <= 2:
try: