This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"users": [ | |
{ | |
"name": "Karan Ahuja", | |
"type": 1 | |
}, | |
{ | |
"name": "Suraj Singh", | |
"type": 0 | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Example 1 Generic Function | |
function convertToArrayLegacy<T>(value: T): T[] { // | |
return [value] | |
} | |
const convertToArray = <T extends unknown>(value: T): T[] => { | |
return [value] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function binarySearch(nums, target) { | |
let left = 0; | |
let right = nums.length - 1 | |
while (left <= right) { | |
let mid = ~~((left + right)/2) | |
if (nums[mid] === target) return mid | |
if (nums[mid] < target) left = mid + 1 | |
if (target < nums[mid]) right = mid - 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is Ashish's NVIM Config Dotfile. | |
-- Set <space> as the leader key | |
-- See `:help mapleader` | |
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) | |
vim.g.mapleader = ' ' | |
vim.g.maplocalleader = ' ' | |
-- Install package manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#WHILE THIS SCRIPT IS MOSTLY NON-INTERACTIVE, SOME SECTIONS DO HAVE EXPLICIT REMARKS TO EXECUTE ACTIONS! WATCH YOUR STEP HERE! | |
sudo apt-get update --yes | |
sudo apt-get dist-upgrade --yes | |
sudo apt-get autoremove --yes | |
sudo apt-get autoclean --yes | |
sudo apt-get install curl tmux zsh nload iotop htop git python3-dev python3-pip apt-transport-https ca-certificates software-properties-common vim mosh --yes | |
#Oh my TMUX | |
git clone https://github.com/gpakosz/.tmux.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use rand::Rng; | |
use std::cmp::Ordering; | |
use std::io; | |
fn main() { | |
println!("Guess the number!"); | |
let secret_number = rand::thread_rng().gen_range(1..=100); | |
loop { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- This is Ashish's NVIM Config Dotfile. | |
-- Set <space> as the leader key | |
-- See `:help mapleader` | |
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used) | |
vim.g.mapleader = ' ' | |
vim.g.maplocalleader = ' ' | |
-- Install package manager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const arrayOne = [ | |
{ value: "4a55eff3-1e0d-4a81-9105-3ddd7521d642", display: "Ashish" }, | |
{ value: "644838b3-604d-4899-8b78-09e4799f586f", display: "Kapoor" }, | |
{ value: "b6ee537a-375c-45bd-b9d4-4dd84a75041d", display: "Pulkit" }, | |
{ value: "e97339e1-939d-47ab-974c-1b68c9cfb536", display: "Smriti" }, | |
{ value: "a63a6f77-c637-454e-abf2-dfb9b543af6c", display: "Neeru" }, | |
]; | |
const arrayTwo = [ | |
{ value: "4a55eff3-1e0d-4a81-9105-3ddd7521d642", display: "Ashish"}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Limit (cost=4895237.19..4897350.43 rows=10000 width=48) (actual time=16791.597..23517.086 rows=1000 loops=1) | |
-> Finalize GroupAggregate (cost=4895237.19..5922277.78 rows=4860039 width=48) (actual time=16791.595..23516.865 rows=1000 loops=1) | |
Group Key: sensor_id, (time_bucket('1 day'::interval, "time")) | |
-> Gather Merge (cost=4895237.19..5800776.80 rows=4860039 width=48) (actual time=16790.127..23513.261 rows=2000 loops=1) | |
Workers Planned: 1 | |
Workers Launched: 1 | |
-> Partial GroupAggregate (cost=4894237.18..5253022.41 rows=4860039 width=48) (actual time=16774.942..23280.625 rows=1000 loops=2) | |
Group Key: sensor_id, (time_bucket('1 day'::interval, "time")) | |
-> Sort (cost=4894237.18..4965708.34 rows=28588464 width=22) (actual time=16763.580..19623.318 rows=24300250 loops=2) | |
Sort Key: sensor_id DESC, (time_bucket('1 day'::interval, "time")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT DATE_TRUNC('day', time) AS __timestamp, | |
fill_level AS fill_level, | |
AVG(sensor_id) AS "AVG(sensor_id)" | |
FROM demo.fill_measurements | |
JOIN | |
(SELECT fill_level AS fill_level__, | |
AVG(sensor_id) AS mme_inner__ | |
FROM demo.fill_measurements | |
GROUP BY fill_level | |
ORDER BY mme_inner__ DESC |
NewerOlder