Skip to content

Instantly share code, notes, and snippets.

View Rubix982's full-sized avatar
:octocat:
🇵🇰

Saif Ul Islam Rubix982

:octocat:
🇵🇰
View GitHub Profile
@Rubix982
Rubix982 / LogWithoutSTLLog.cpp
Last active December 26, 2019 05:20
Implementation of Algorithm to calculate log of any base to any precision, using the technique described here: https://math.stackexchange.com/questions/820094/what-is-the-best-way-to-calculate-log-without-a-calculator#
#include <iostream>
#include <math.h>
#include <string>
using namespace std;
int main(void) {
uint_fast64_t b, p;
double start = 2;
@Rubix982
Rubix982 / NumberOfDigitsInTimeO(1).cpp
Created December 26, 2019 05:47
Gets back num of digits in O(1) time
#include "stdc++.h"
using namespace std;
// Gives back the number of digits in O(1) time
int main(void) {
std::cout << "<------- START ------->" << "\n";
for (int i = 1; i <= 50000; ++i) std::cout << (int) floor( 1 + log10( (double) i ) ) << " " << i << "\n";
@Rubix982
Rubix982 / NthRoot.cpp
Last active December 26, 2019 06:55
Gives back Nth Root of a non-negative value, 'a'
#include <iostream>
using namespace std;
/*
Find nth root of a value a, Code from
https://www.quora.com/How-do-I-write-a-program-in-C-that-will-compute-the-nth-root-of-a-number-by-using-a-numerical-approximation-Newtons-Method-Calculations-must-be-based-on-just-square-and-or-cubic-roots
*/
double root ( double a, int n );
double IntPowFast( double x, int n );
#include <bits/stdc++.h>
using namespace std;
int main(void)
{
// Generates the value of the macro PI, without having to rely on an already existing macro in C++
// Since the macro varies from compiler to compiler
std::cout << "Value of PI: " << std::setprecision(20) << acos(-1) << std::endl;
return 0;
@Rubix982
Rubix982 / ChrisLattner,AI_Podcast_Notes.md
Created April 16, 2020 17:50
Chris Lattner: Compilers, LLVM, Swift, TPU, and ML Accelerators | Artificial Intelligence Podcast

Lex Fridman And Chris Lattner: on Compilers, LLVM, Swift, TPU, and ML Accelerators - Notes

This is a textual summary and list of notes of the podcast 'Artificial Intelligence Podcast' by Lex Fridman, from the episode Chris Lattner: Compilers, LLVM, Swift, TPU, and ML Accelerators.

About Chris Lattner:

Currently senior director at Google, working for projects covering CPU, GPU accelerators for Tensorflow, Google's library for Machine and Deep Learning, also involved in Swift related projects  

What Were Your First Initial Stages?

Performed basic programming by read and copying code from books  Started with simple GWBase, QBasic, then transitioned to Pascal, C, C++, and so and so forth.

@Rubix982
Rubix982 / stochastic-gradient-descent-rate-and-momentum.ipynb
Created May 12, 2020 16:01
Stochastic Gradient Descent - Rate And Momentum
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
There was an error in your GraphQL query:
Cannot query field "codeinjection_head" on type "GhostSettings".
If you don't expect "codeinjection_head" to exist on the type "GhostSettings" it is most likely a typo.
However, if you expect "codeinjection_head" to exist there are a couple of solutions to common problems:
- If you added a new data source and/or changed something inside gatsby-node.js/gatsby-config.js, please try a restart of your development server
- The field might be accessible in another subfield, please try your query in GraphiQL and use the GraphiQL explorer to see which fields you can query and what shape they have
- You want to optionally use your field "codeinjection_head" and right now it is not used anywhere. Therefore Gatsby can't infer the type and add it to the GraphQL schema. A quick fix is to add a least one entry with that field ("dummy content")
@Rubix982
Rubix982 / pthread-fail-logs.log
Created September 14, 2020 09:06
pthread failing, not sure why, related stack overflow question here,
Size of arrays, given as 100.
[ARRAY_A] Time taken to get the array, 5e-06
[ARRAY_B] Time taken to get the array, 2e-06
[ARRAY_C] Time taken to get the array, 2e-06
Overall time taken to generate arrays, 9e-06.
-------------
USING SERIAL:
Overall time taken, using insertion sort - serial, 2e-06.
  • OS Concepts
    • Process vs Threads
    • Serial vs Parallel Execution
    • Singlge vs Multithreading Process
  • Parallel Computing
    • Computational Problem
    • Applications
    • Why?
    • Limitations Of Serial Computing
  • Amdahl's Law