Skip to content

Instantly share code, notes, and snippets.

View graphoarty's full-sized avatar
🎯
Focusing

Quinston Pimenta graphoarty

🎯
Focusing
  • https://quinston.com
  • Pune, India
View GitHub Profile
@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);
}
@graphoarty
graphoarty / gist:6123c968de24beb8306c6dc002997808
Created July 17, 2020 11:13
Python 3.7 Script for Generating Mac ICNS File from PNG Logo
from PIL import Image
import os
logo_path = '/path/to/logo.png'
resize_sizes = [
{
"file_name": "icon_16x16.png",
"size": (16, 16)
},
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
static Scanner scan;
public static void main(String[] args) {
scan = new Scanner(System.in);
ArrayList<Integer> factors = new ArrayList<Integer>();