Skip to content

Instantly share code, notes, and snippets.

View aliahmadcse's full-sized avatar
🎯
Developing 😶

Ali Ahmad aliahmadcse

🎯
Developing 😶
View GitHub Profile
@aliahmadcse
aliahmadcse / README.md
Created June 26, 2024 10:23
setting-up-cassandra-locally-on-docker

--hostname cassandra --network cassandra

Starting the docker container

``

public class RideFareCalculator {
// in real system, these values must be configurable outside of code
private static final double BASE_FARE = 3.0;
private static final double RATE_PER_KM = 2.50;
private static final double RATE_PER_MINUTE = 0.50;
private static final double MINIMUM_FARE = 5.0;
public static double calculateFare(double distanceKm, double timeMinutes, double surgeMultiplier) {
if (distanceKm < 0 || timeMinutes < 0 || surgeMultiplier < 0) {
@aliahmadcse
aliahmadcse / app.js
Created January 11, 2022 19:43
Backup
const fs = require("fs");
let data = fs.readFileSync("./quicksearch.json");
data = data.toString().trim().split("\n").map(JSON.parse);
const usernames = new Set();
for (let row of data) {
if (row.headers) {
@aliahmadcse
aliahmadcse / java16-user.bat
Last active September 9, 2023 20:31
change_java-version
@echo off
set JAVA_HOME=C:\Users\Dell\.jdks\openjdk-17.0.2
setx JAVA_HOME "%JAVA_HOME%"
set Path=%JAVA_HOME%\bin;%Path%
echo Java 17 activated as user default.
move c:\Users\Dell\.m2\*.xml c:\Users\Dell\.m2\settings
echo setting files moved inside successfully
@aliahmadcse
aliahmadcse / index.js
Created January 29, 2021 07:14
Given a number n. Return true if that is a power of 2.
/**
* check if N is a power of 2
* e.g, if N=8, then N is 2^3
*/
const isPowerOfTwo = (num) => {
// odd number can never be a power of two
if (num % 2 !== 0) return false;
let quotient = 0;
let chunks = [];
@aliahmadcse
aliahmadcse / main.cpp
Last active December 3, 2020 18:15
Write a c++ function that splits the string X into an array bases on the delimeter character Y.
/**
* @author Ali Ahmad
* The program solves the following problem
*
* Write a c++ function that splits the string X into an array
* bases on the delimeter character Y.
* string* tokenizer(string X, char Y)
*
* Test cases:
* X: "1,2,3,4" Returns string array of size 4 with the elements
@aliahmadcse
aliahmadcse / survey.js
Last active September 24, 2020 12:37
UETIANS, We all know, how frustrating is it to fill course survey for each subject and marking those dumb radio buttons. So I have written this short script 😃 to automate this process. On your survey question air page, open developer tools (ctrl+shift+I) and then JS console and copy paste this script into console and hit enter. And that's it, al…
// for random selection of radio buttons
const radioContainers = document.querySelectorAll(".js_radio");
radioContainers.forEach((container) => {
const radioInputs = container.querySelectorAll("input");
const index = Math.round(Math.random() * 4);
radioInputs[index].checked = true;
});
class foo {
var $x = 'y'; // or you can use public like...
public $x = 'y'; //this is also a class member variables.
function bar() {
}
}