Skip to content

Instantly share code, notes, and snippets.

View MahraibFatima's full-sized avatar
:fishsticks:
striving

Mahraib Fatima MahraibFatima

:fishsticks:
striving
View GitHub Profile
Aspect Ants Humans
First Appeared 100–150 million years ago ~300,000 years ago
Civilization Always social Only ~10,000 years old
Global Spread Survived mass extinctions Still adapting
Factor Dinosaurs Ants
Size Massive (up to 100+ feet) Tiny (0.08–1 inch)
Adaptability Slow to evolve Rapid evolution
Social Structure Mostly solitary Highly organized colonies
Survival Strategy Dominance through size Dominance through teamwork

The Three Castes of Ants

Caste Role Lifespan
Queen Lays eggs (thousands in her lifetime) Up to 30 years
Workers (All female) Build, forage, defend, nurse larvae Weeks to months
Males Mate with queens, then die Days to weeks
Method Learns Parameters Applies Transformation Use Case
fit() Yes No Initial learning step.
transform() No Yes Applying learned transformation.
fit_transform() Yes Yes Convenient for initial training data.
@MahraibFatima
MahraibFatima / guided_backprop.py
Created July 3, 2025 15:54 — forked from MFreidank/guided_backprop.py
Torch Guided Backprop -- ResNet Compatible version
"""
Created on Thu Oct 26 11:23:47 2017
Original Author:
@author: Utku Ozbulak - github.com/utkuozbulak
Changes for ResNet Compatibility:
Moritz Freidank - github.com/MFreidank
"""
import torch
@MahraibFatima
MahraibFatima / showSalaries.java
Created May 31, 2025 05:28
showSalaries method
public static void showSalaries(Connection conn, String dept) {
String sql = "SELECT name, salary FROM employees WHERE department = ?";
try (PreparedStatement stmt = conn.prepareStatement(sql)) {
stmt.setString(1, dept);
ResultSet rs = stmt.executeQuery();
while (rs.next()) {
String name = rs.getString("name");
double salary = rs.getDouble("salary");
System.out.println(name + " - " + salary);
}
@MahraibFatima
MahraibFatima / main.java
Created May 31, 2025 02:43
basic with swing and java visual programming
//Step 1: import lib
import javax.swing.*;
import java.awt.*;
public class Main {
public static void main(String[] args) {
//step 2: Top level Frame / window
JFrame frame= new JFrame();
//step 3: container to frame
@MahraibFatima
MahraibFatima / Eid_Cringe_Msg.cpp
Created April 1, 2025 18:51
Your task is to determine which message is the most cringeworthy by computing its "cringe score" as follows: Each vowel (a, e, i, o, u — in any case) adds 1 point. Each standalone occurrence of the word "Eid" adds a bonus of 3 points. The message with the highest cringe score wins the championship. If there’s a tie, pick the one that appears fir…
// Example program
#include <iostream>
#include<vector>
#include <string>
using namespace std;
int main()
{
int no_of_eid_messages=0;
cout<<"Enter number of eid messages: ";
@MahraibFatima
MahraibFatima / Largest_odd_string.cpp
Created February 5, 2025 14:25
Largest Odd Number in String
#include <iostream>
#include <string>
using namespace std;
// Brute Force
string largestOddNumber(string number) {
int save = -1;
for(int i=number.size()-1; i>=0; --i){
// string ch = ;
int n = number[i] - '0';
@MahraibFatima
MahraibFatima / reverse_words_in_string.cpp
Created February 5, 2025 12:47
without extra multiple space between two words.
#include <iostream>
#include <string>
#include <stack>
#include <tuple>
using namespace std;
string reverseWords(string sentence) {
stack<string> words_stack;
string word = "";
for(int i=0; i<sentence.size(); ++i){
if(sentence[i] == ' ' && word != ""){