Skip to content

Instantly share code, notes, and snippets.

Avatar

Nauman Umer nmanumr

View GitHub Profile
@nmanumr
nmanumr / remove-merged.sh
Created Jan 13, 2022
remove all the merged branches
View remove-merged.sh
git --no-pager branch --merged main | xargs git branch -d
View cfg.h
#include <iostream>
#include <string>
#include <list>
#include <unordered_map>
#include <set>
using namespace std;
#ifndef CC_CFG_H
#define CC_CFG_H
View eliminate_lr.java
package practice;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.Scanner;
public class eliminate_lr {
@nmanumr
nmanumr / rotate.js
Last active May 20, 2021
rotate youtube video
View rotate.js
let conf = {
flipX: false,
flipY: true,
angle: 180,
};
function rotate(){
let theaterButton = $('.ytp-size-button.ytp-button');
if (theaterButton.title.includes("Theater")) {
setTimeout(rotate, 200);
@nmanumr
nmanumr / MonthSelector.tsx
Created May 15, 2021
Month Selector in React
View MonthSelector.tsx
import { Component, createRef, RefObject } from "react";
import c from 'classnames';
/*---------------------
* Component Types
*---------------------*/
interface State {
years: number[],
selected: string[],
@nmanumr
nmanumr / assignment01.py
Created Oct 9, 2020
NC assignment Bisection method, false position
View assignment01.py
import math
def r(x):
return str(round(x, 6))
def bisection_print(fn, xl, xu, last_xm=None, last_err=None, iter=1):
out_str = f"\\textbf{{Iteration {iter}}}\n\n"
out_str += "\n\\vspace{20pt}\\textbf{Step 1}\n"
out_str += f"$$ x_{{l}} = {r(xl)}, x_{{u}} = {r(xu)} $$\n"
View test.py
import timeit
from terminaltables import SingleTable
def bubble_sort(arr):
for i in range(len(arr) - 1):
for j in range(0, len(arr) - i - 1):
if arr[j] > arr[j + 1]:
arr[j], arr[j + 1] = arr[j + 1], arr[j]
@nmanumr
nmanumr / feedback.js
Last active Jun 12, 2021
This script can automatically mark feedback for CUOnline Students Portal
View feedback.js
let stars = () => 1 + Math.round(Math.random() * 4);
// uncomment this if you want fixed stars
// stars = () => 3;
// 'SUBJECT_CODE': [COURSE_STARS, FACULTY_STARS]
// for example `'CSE356': [1, 1]`
const specialSubjects = {
}
if (window.location.pathname == '/Feedback') {
@nmanumr
nmanumr / GPA.js
Created Jan 22, 2020
CUONLINE scripts
View GPA.js
"use strict";
class GpaService {
constructor() {
this.s1Weight = 10;
this.s2Weight = 15;
this.finalWeight = 50;
this.quizWeight = 15;
this.assignWeight = 10;
}
calcTotal(entity) {
@nmanumr
nmanumr / 4 letter words.java
Last active Oct 30, 2019
150 most used words
View 4 letter words.java
String[] words = {"that", "this", "with", "from", "your", "have", "more", "will", "home", "page", "free", "time", "they", "site", "what", "news", "only", "when", "here", "also", "help", "view", "been", "were", "some", "like", "than", "find", "date", "back", "list", "name", "just", "over", "year", "into", "next", "used", "work", "last", "most", "data", "make", "them", "post", "city", "such", "best", "then", "good", "well", "info", "high", "each", "very", "book", "read", "need", "many", "user", "said", "does", "mail", "full", "life", "know", "days", "part", "real", "item", "ebay", "must", "made", "line", "send", "type", "take", "area", "want", "long", "code", "show", "even", "much", "sign", "file", "link", "open", "case", "same", "both", "game", "care", "down", "size", "shop", "text", "rate", "form", "love", "john", "main", "call", "save", "york", "card", "jobs", "food", "sale", "teen", "room", "join", "west", "look", "left", "team", "week", "note", "live", "june", "plan", "cost", "july", "test", "come", "cart"