Skip to content

Instantly share code, notes, and snippets.

View gauravssnl's full-sized avatar
😸
use code::latest ;

GAURAV gauravssnl

😸
use code::latest ;
View GitHub Profile
@gauravssnl
gauravssnl / Mutex.md
Created December 6, 2022 15:52 — forked from cpq/Mutex.md
What is a mutex and how does it work

What is a mutex and how does it work

Imagine a big office (your program), with many assets (shared resources) and many employees (threads). For example, all employees share one common resource - a toilet. They have agreed to use a label on a toilet's door (mutex).

When an employee wants to use the toilet he checks a label on a door (locks a mutex). If it is "engaged" he waits (blocks on a mutex), then when it is "free", he enters the toilet and changes the label to

@gauravssnl
gauravssnl / Stack.md
Created December 6, 2022 15:51 — forked from cpq/Stack.md
Why stack grows down

Why stack grows down

Any running process has several memory regions: code, read-only data, read-write data, et cetera. Some regions, such as code and read-only data, are static and do not change over time. Other regions are dynamic: they can expand and shrink. Usually there are two such regions: dynamic read-write data region, called heap, and a region called stack. Heap holds dynamic memory allocations, and stack is mostly used for keeping function frames.

Both stack and heap can grow. An OS doesn't know in advance whether stack or heap will be used predominantly. Therefore, an OS must layout these two memory regions in a way to guarantee maximum space for both. And here is the solution:

  1. Layout static memory regions at the edges of process's virtual memory
  2. Put heap and stack on edges too, and let them grow towards each other: one grows up, one grows down
@gauravssnl
gauravssnl / google-apps-script.md
Created December 6, 2022 14:36 — forked from labnol/google-apps-script.md
How to Learn Google Apps Script

Learning Google Apps Script

Find the best resources for learning Google Apps Script, the glue that connects all GSuite services including Gmail, Google Drive, Calendar, Google Sheets, Forms, Maps, Analytics and more.

A good place to learn more about Google Apps Script is the official documentation available at developers.google.com. Here are other Apps Script resources that will help you get up to speed.

  1. Google Apps Script Code Samples by Amit Agarwal
  2. Google Apps Script Development - Create Google Apps Script projects locally inside VS Code - video tutorial
  3. Awesome Google Scripts by Amit Agarwal
  4. Google Developer Experts - Follow Apps Scr
@gauravssnl
gauravssnl / pdnsd.conf
Created November 27, 2022 17:51 — forked from gorakhargosh/pdnsd.conf
pdnsd.conf
// Sample pdnsd configuration file. Must be customized to obtain a working pdnsd setup!
// Read the pdnsd.conf(5) manpage for an explanation of the options.
// Add or remove '#' in front of options you want to disable or enable, respectively.
// Remove '/*' and '*/' to enable complete sections.
global {
perm_cache=999999;
cache_dir="/usr/local/var/cache/pdnsd";
# pid_file = /var/run/pdnsd.pid;
run_as="nobody";
@gauravssnl
gauravssnl / autocomplete.js
Created November 24, 2022 05:33 — forked from gd3kr/autocomplete.js
twitter autocomplete hack v2
//MIT license (ie. do whatever tf you want with this code)
//Paste directly into console or GreaseMonkey https://greasyfork.org/en/scripts/455318-twitter-from-ui-upgrade
let search;
let fromFlag = false;
setTimeout(() => {
search = document.querySelectorAll(
"input[placeholder='Search Twitter']"
)[0];
@gauravssnl
gauravssnl / SimpleServer.py
Created November 8, 2022 21:48 — forked from pigscanflyyyy/SimpleServer.py
Simple Server ; QPython
#!/usr/bin/env python2
#!/usr/bin/python2
#-*-coding:utf8-*-
#qpy:console
""" SimpleServer.py -h
Original Version By InunxLABS 1.00.10 - 22/07/13
Mail : inunxlabs@gembox.us
Paypal : inunxelex@yahoo.com
Payza : inunxlabs@gmail.com
@gauravssnl
gauravssnl / ray.cc
Created September 28, 2022 07:01 — forked from zserge/ray.cc
Minimal ray tracer for leaning purposes
#include <array>
#include <cmath>
#include <fstream>
#include <iostream>
#include <vector>
struct Vec {
float x, y, z;
Vec(float vx, float vy, float vz) : x(vx), y(vy), z(vz) {}
Vec operator+(Vec vec) { return {x + vec.x, y + vec.y, z + vec.z}; }
@gauravssnl
gauravssnl / AwesomeCourses.md
Created September 14, 2022 15:41 — forked from teocci/AwesomeCourses.md
List of awesome university courses for learning Computer Science!

Awesome Courses Awesome

Introduction

There is a lot of hidden treasure lying within university pages scattered across the internet. This list is an attempt to bring to light those awesome courses which make their high-quality material i.e. assignments, lectures, notes, readings & examinations available online for free.

Table of Contents

Buy Dirt Jordan Davis & Lu
Cruel Summer Taylor Swift
Gorgeous Taylor Swift
Death By A Thousand Cut Taylor Swift
Sixteen Thomas Rhett
invisible string Taylor Swift
Nothing New (feat. Phoe Taylor Swift & Ph
All You Had To Do Was S Taylor Swift
Next To You New West
It'll Be Okay Shawn Mendes
#[macro_export]
macro_rules! select {
// Done normalizing
(@ { $($t:tt)* }) => {
$crate::select_imp!( $($t)* )
};
(@ { $($t:tt)* } $b:pat = $f:expr => $h:block $($r:tt)* ) => {
$crate:select!(@{ $($t)* $b = $f => $h, } $($r)*)
};