Skip to content

Instantly share code, notes, and snippets.

View JyotinderSingh's full-sized avatar
:octocat:
Building and breaking things

Jyotinder Singh JyotinderSingh

:octocat:
Building and breaking things
View GitHub Profile
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"net/http"
"github.com/dicedb/dicedb-go"
@JyotinderSingh
JyotinderSingh / leaderboard.go
Created October 12, 2024 15:02
leaderboard
package main
import (
"context"
"encoding/json"
"fmt"
"log"
"math/rand"
"net/http"
"os"
@JyotinderSingh
JyotinderSingh / script.sh
Created April 11, 2024 06:40
Jupyter Notebook Auto Complete: Install hinterland for conda
conda activate <env_name>
conda install -c conda-forge jupyter_contrib_nbextensions
jupyter nbextensions_configurator enable --user
jupyter contrib nbextension install --user
jupyter nbextension enable hinterland/hinterland
@JyotinderSingh
JyotinderSingh / oktaLogin.js
Created December 16, 2021 07:03 — forked from ndavis/oktaLogin.js
Cypress Custom Command for Okta Login
Cypress.Commands.add('loginOkta', () => {
const optionsSessionToken = {
method: 'POST',
url: Cypress.env('session_token_url'),
body: {
username: Cypress.env('username'),
password: Cypress.env('password'),
options: {
warnBeforePasswordExpired: 'true'
}
diff --git a/compiler/build.gradle b/compiler/build.gradle
index 60d3a436f..409df7a03 100644
--- a/compiler/build.gradle
+++ b/compiler/build.gradle
@@ -31,6 +31,7 @@ def addLibraryIfNotLinked = { libName, argList ->
}
def String arch = rootProject.hasProperty('targetArch') ? rootProject.targetArch : osdetector.arch
+// arch = arch.replace('osx_arm-v8', 'osx_aarch64')
def boolean vcDisable = rootProject.hasProperty('vcDisable') ? rootProject.vcDisable : false
@JyotinderSingh
JyotinderSingh / MergeIntervals.cpp
Created July 29, 2020 09:02
Merge Intervals (LeetCode) | Interview Question Explanation
// https://leetcode.com/problems/merge-intervals/
class Solution
{
public:
vector<vector<int>> merge(vector<vector<int>> &intervals)
{
sort(intervals.begin(), intervals.end(), [](auto &vec1, auto &vec2) {
// if the start timings are equal
if (vec1[0] == vec2[0])
{
@JyotinderSingh
JyotinderSingh / ReduceArraySizeToTheHalf.cpp
Created July 22, 2020 09:02
Reduce Array Size to the Half (LeetCode) | Interview Question Explained
class Solution {
public:
int minSetSize(vector<int>& arr) {
unordered_map<int, int> freq;
for(int i = 0; i < arr.size(); ++i) freq[arr[i]]++;
priority_queue<int> pq;
for(auto iter: freq) pq.push(iter.second);
@JyotinderSingh
JyotinderSingh / AddBinary.cpp
Created July 19, 2020 08:09
Add Binary (LeetCode) | Interview Question Explanation
class Solution {
public:
string addBinary(string a, string b) {
string res;
int i = a.size() - 1, j = b.size() - 1;
int sum, carry = 0;
while(i >= 0 || j >= 0) {
sum = carry;
if(i >= 0) sum += a[i--] - '0';
if(j >= 0) sum += b[j--] - '0';
@JyotinderSingh
JyotinderSingh / CourseSchedule2.cpp
Created July 18, 2020 08:02
Course Schedule II (LeetCode) | Topological Sort DFS Explanation
// https://leetcode.com/problems/course-schedule-ii/
class Solution
{
/*
* finished[i] can take one of three values:
* -1 -> the node i has never been visited
* 0 -> the node i has been visited but is currently in process of completing pre-requisites
* 1 -> the node i has finished both the pre-requisites and the course
*/
vector<int> res;
@JyotinderSingh
JyotinderSingh / RotateList.cpp
Created July 17, 2020 07:32
Rotate List (LeetCode) | Interview Question Explanation
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode() : val(0), next(nullptr) {}
* ListNode(int x) : val(x), next(nullptr) {}
* ListNode(int x, ListNode *next) : val(x), next(next) {}
* };
*/