Skip to content

Instantly share code, notes, and snippets.

View philopaterwaheed's full-sized avatar
🥰
planitly for the win

philo san philopaterwaheed

🥰
planitly for the win
View GitHub Profile
fn main() {
initscr();
noecho();
keypad(stdscr(), true);
start_color();
init_pair(REGULAR_PAIR, COLOR_WHITE, COLOR_BLACK);
init_pair(HIGHLIGHT_PAIR, COLOR_BLACK, COLOR_WHITE);
let mut quit = false ;
let mut rows = 0;
@philopaterwaheed
philopaterwaheed / matrix_multiply.cpp
Created March 6, 2024 08:06
multiply matrix from and out to files using vectors
#include <cctype>
#include <istream>
#include <algorithm>
#include <bits/chrono.h>
#include <ctime>
#include <iostream>
#include <chrono>
#include <fstream>
#include <string>
#include <vector>
while (t--)
{
int out = 0 , last = 0 ;
dec (int , n , m , k );
array(int , dis , n );
array(int , size , m);
std :: sort (dis.begin() , dis.end());
std :: sort (size.begin() , size.end());
int ptr1 = 0 , ptr2 = 0 ;
@philopaterwaheed
philopaterwaheed / windows_c++_clicker.cpp
Created February 3, 2024 07:33
an auto clicker written in c++
#include <iostream>
#include <windows.h>
#include <string>
#include<array>
using namespace std;
bool working=true;
bool waiting=false;
@philopaterwaheed
philopaterwaheed / picom.conf
Created February 2, 2024 09:02
picom config
#################################
# Transitions #
#################################
# When windows get moved or resized it transitions window position
transition = true;
# How many pixels move window to make the first position in transition (defaults to 20)
transition-offset = 20;
@philopaterwaheed
philopaterwaheed / prime_factorization.cpp
Last active February 2, 2024 07:27
- Prime factorization is the process of finding the prime factors of a given number `n`
vector <pair <long long , int > > pri (long long n ) {
vector <pair <long long , int > > f ;
for ( long long d = 2 ; d *d <= n ; d++ ) {
int p = 0 ;
while (n % d == 0 ) {
n/= d;
p++ ;
}
if (p)
@philopaterwaheed
philopaterwaheed / either.rs
Last active February 6, 2024 07:32
rust problem solving basics only
use either::Either;
fn sum_mix(arr: &[Either<i32, String>]) -> i32 {
let mut x : i32 = 0 ;
for my_either in arr {
match my_either{
Either::Left(left_value) => {
println!("Left value: {}", left_value);
x = x+ left_value;
}
@philopaterwaheed
philopaterwaheed / is_prime.cpp
Created January 31, 2024 08:58
a function to determine if a number is prime or now
bool is_prime (int n )
{
if (n == 2 )
return true;
if ( n == 1 )
return false ;
for (int i =2 ; i * i < (n) ; i ++ )
if (n % i == 0 )
return false;
return true;
@philopaterwaheed
philopaterwaheed / get_all_primes_under.cpp
Created January 31, 2024 08:43
the best algorithem to get all prime nubers under an int
std :: vector primes_under (int n ) {
std::vector<bool> isPrime(n + 1, true);
std :: vector <int> primes ;
for (int p =2 ; p * p< (n) ; p ++ )
if (isPrime[p]) {
// If p is prime, mark all multiples of p as non-prime
for (int i = p * p; i <= n; i += p) {
isPrime[i] = false;
}
}
@philopaterwaheed
philopaterwaheed / brainfuck_interpreter.cpp
Created January 31, 2024 08:25
simple brainfuck interpreterin c++
#include <iostream>
#include <vector>
#include <fstream> // for file reading
#include <filesystem>// to check if it is there ;
#include <stack>
#include <string>
#include <system_error>
//funcs
bool isvalid(std::string s) ;
void operate(std :: string s);