Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Quinston Pimenta graphoarty

🎯
Focusing
View GitHub Profile
@graphoarty
graphoarty / subsets.cpp
Last active Nov 26, 2020
Generate Subsets in C++
View subsets.cpp
#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 Nov 22, 2020
Dynamically Allocate Matrix in C
View dynamically-allocate-matrix-in-c.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 Sep 20, 2020
Upload File to S3 from URL (Firebase Functions / 2020)
View gist:8c9276cb96d2f09e4bdad27ba06bdcc5
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 Jul 21, 2020
Gist for Converting an Array into a 32bit Floating Point Buffer for WebRTC Voice Activity Detection (javascript, node-vad)
View gist:4256f42cd2a10cdbfb58f19de0720821
// 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 Jul 17, 2020
Python 3.7 Script for Generating Mac ICNS File from PNG Logo
View gist:6123c968de24beb8306c6dc002997808
from PIL import Image
import os
logo_path = '/path/to/logo.png'
resize_sizes = [
{
"file_name": "icon_16x16.png",
"size": (16, 16)
},
View gist:2c74b6605874629d9f6fd0b186ea431c
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>();
View gist:adb11e34d6a321d5a9544b20555892c6
import random
matrix = [[0 for x in xrange(5)] for x in xrange(5)]
visited = [[0 for x in xrange(5)] for x in xrange(5)]
def printMatrix(toPrint):
for x in range (0, 5):
for y in range (0, 5):
print toPrint[x][y],
print
def RecursiveLoop(a, b):
coorD = 0;
View gist:b6c7cd20a55bb979354a008f02392004
def cartesianProduct(setA, setB):
if len(setA) == 0:
return None
if len(setB) == 0:
return None
product = []
for elementA in setA:
View gist:c887f892965dc6e8b33494a18820fe18
def main():
count = int(raw_input("How many numbers do you want to print?"))
if count == 0:
print "No Numbers Printed"
else:
a = 0
b = 1
print a,
if count > 1:
print b,
View gist:5ace6fc1dd2740106ee5e022ecc4ddfb
public class Main {
/* Static variable which acts as the pointer for the postOrder list */
static int preIndex = 5;
public static void main(String[] args) {
/* InOrder Array */
char[] inOrder = { 'D', 'B', 'E', 'A', 'F', 'C' };
/* PostOrder Array */
You can’t perform that action at this time.