Skip to content

Instantly share code, notes, and snippets.

View naemazam's full-sized avatar
🎯
Focusing

Naem Azam naemazam

🎯
Focusing
View GitHub Profile
@naemazam
naemazam / Download Protected or View Only PDF from Google Drive
Created November 19, 2022 06:38
Download Protected/View Only PDF from Google Drive use this code on Console
let jspdf = document.createElement("script");
jspdf.onload = function () {
let pdf = new jsPDF();
let elements = document.getElementsByTagName("img");
for (let i in elements) {
let img = elements[i];
console.log("add img ", img);
if (!/^blob:/.test(img.src)) {
console.log("invalid src");
continue;
// Quick sort in C
#include <stdio.h>
// function to swap elements
void swap(int *a, int *b) {
int t = *a;
*a = *b;
*b = t;
}
// Quick sort in Java
import java.util.Arrays;
class Quicksort {
// method to find the partition position
static int partition(int array[], int low, int high) {
// choose the rightmost element as pivot
# Quick sort in Python
# function to find the partition position
def partition(array, low, high):
# choose the rightmost element as pivot
pivot = array[high]
# pointer for greater element
i = low - 1
@naemazam
naemazam / sums of two diagonals and sum diagonal of a matrix
Created May 7, 2022 08:38
computing the sums of two diagonals and sum diagonal of a matrix in c language
\\\ sum of main diagonal
/// sum of sub diagonal
#include <stdio.h>
void main ()
{
static int array[10][10];
int i, j, m, n, a = 0, sum = 0;
@naemazam
naemazam / array in reverse order
Last active March 7, 2022 09:31
define a function reverse() to reverse array elements and take input then call reverse() in main().
// ALGORITHM:
STEP 1: START
STEP 2: INITIALIZE arr[] = {1, 2, 3, 4, 5}
STEP 3: length= sizeof(arr)/sizeof(arr[0])
STEP 4: PRINT "Original Array:"
STEP 5: REPEAT STEP 6 and STEP 7 UNTIL i<length
STEP 6: PRINT arr[i]
STEP 7: i=i+1
STEP 8: PRINT new line.
STEP 9: PRINT "Array in reverse order"
@naemazam
naemazam / negative numbers in Array
Created March 7, 2022 09:03
declare an array to save 10 integers output all the negative numbers
/* C Program to Print Negative Numbers in an Array */
#include<stdio.h>
int main()
{
int Size, i, a[10];
Size = 10;
printf("\n Please Enter the Array Elements : ");
/*
num is static -> no need to initialize (=0)
(int)'d' = ascii value of 'd' (=100)
*/
public class Program
{
static int num;
public static void main(String[] args) {
while(num < (int)'d'){
@naemazam
naemazam / bookmark.js
Created November 4, 2021 07:26 — forked from oilvier/bookmark.js
Javascript to add a bookmark - Cross Browser
/**
*
* Add to bookmark
* Several tests are necessary in order for this "simple" action to work in most of the browsers
*
*/
// First, we define the element where the "Add to bookmark" action will trigger
var triggerBookmark = $(".js-bookmark"); // It must be an `a` tag
# A basic code for matrix input from user
R = int(input("Enter the number of rows:"))
C = int(input("Enter the number of columns:"))
# Initialize matrix
matrix = []
print("Enter the entries rowwise:")
# For user input