Skip to content

Instantly share code, notes, and snippets.

View graphoarty's full-sized avatar
🎯
Focusing

Quinston Pimenta graphoarty

🎯
Focusing
View GitHub Profile
@graphoarty
graphoarty / gist:d0c97bea1a14c7e649bd7c864873d4e2
Created September 7, 2024 09:33
mean speed between contested counties
# India
# delhi: With a population of 33,807,403 as of 2024.
# mumbai: With a population of 21,673,149 as of 2024.
# kolkata: With a population of 15,570,786 as of 2024.
# Somalia
# mogadishu: With a population of 2,587,183 as of 2024
# hargeisa: With a population of 1,176,617 as of 2024
# bossaso: With a population of 615,067 as of 2024
@graphoarty
graphoarty / keybindings.json
Created July 27, 2024 14:11
Move Cursor Up And Down By 10 Lines (VS Code)
// Reference: https://stackoverflow.com/a/70599253
[
{
"key": "ctrl+up",
"command": "cursorMove",
"args": {
"to": "up",
"by": "line",
"value": 10
},
@graphoarty
graphoarty / gist:55ca889a5ec407eae74466c0ec12d85e
Created November 25, 2023 11:39
blur select box after selection (even if value is unchanged)
let selectDropDownActive = false;
let selectDropDownActiveItem = null;
$(window).blur(function() {
BlurActiveSelectBox();
})
$('select').click(function() {
if (selectDropDownActiveItem != this) {
import asyncio
def SendEmail(email, subject, message):
import threading
t = threading.Thread(target=SendEmailThread, args=(email, subject, message))
t.start()
def SendEmailThread(email, subject, message):
@graphoarty
graphoarty / gist:e12176c679ef9f8696f2c1e949ddb859
Created December 2, 2020 11:10
Forming a Magic Square - Hackerrank in C++
#include <bits/stdc++.h>
using namespace std;
void PrintVector(vector<int> vec){
int n = (int) vec.size();
for(int i = 0; i < n; i++){
cout << vec[i] << " ";
}
cout << endl;
@graphoarty
graphoarty / tree_top_view.cpp
Created November 28, 2020 04:18
Tree - Top View in C++
#include<bits/stdc++.h>
using namespace std;
class Node {
public:
int data;
Node *left;
Node *right;
Node(int d) {
@graphoarty
graphoarty / subsets.cpp
Last active November 26, 2020 15:24
Generate Subsets in C++
#include<iostream>
#include<vector>
using namespace std;
int print_vector(vector<int> arr){
for(int i = 0; i < (int) arr.size(); i++){
cout << arr[i] << " ";
}
@graphoarty
graphoarty / dynamically-allocate-matrix-in-c.c
Created November 22, 2020 14:12
Dynamically Allocate Matrix in C
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char *argv[]){
int rows = 3;
int cols = 3;
// allocate memory to store pointers which point to each row
int** matrix = (int **) malloc(rows * sizeof(int *));
@graphoarty
graphoarty / gist:8c9276cb96d2f09e4bdad27ba06bdcc5
Created September 20, 2020 15:54
Upload File to S3 from URL (Firebase Functions / 2020)
const functions = require('firebase-functions');
const AWS = require('aws-sdk');
var https = require('https');
const cors = require('cors')({origin: true});
AWS_ACCESS_KEY = "aws-access-key-goes-here";
AWS_SECRET_KEY = "aws-secret-key-goes-here";
BUCKET_NAME = "bucket-name-goes-here";
const s3 = new AWS.S3({
@graphoarty
graphoarty / gist:4256f42cd2a10cdbfb58f19de0720821
Created July 21, 2020 14:44
Gist for Converting an Array into a 32bit Floating Point Buffer for WebRTC Voice Activity Detection (javascript, node-vad)
// Javascript
// Using node-vad
floatingPointArray = [...];
let buf = Buffer.allocUnsafe(4 * floatingPointArray.length);
for (var k = 0 ; k < floatingPointArray.length ; k++) {
buf.writeFloatLE(floatingPointArray[k], k * 4);
}