Skip to content

Instantly share code, notes, and snippets.

View karngyan's full-sized avatar
📌
working from my bed

Karn karngyan

📌
working from my bed
View GitHub Profile
@karngyan
karngyan / main.go
Created August 8, 2021 02:10
Mutex/RWMutex
package main
import (
"fmt"
"math"
"os"
"sync"
"text/tabwriter"
"time"
)
@karngyan
karngyan / aws.nuxt.s3.gulpfile.js
Created May 20, 2021 19:58
Gulpfile to automate nuxt generate deployments to S3 backed by Cloudfront CDN, Caches _nuxt for an year.
const gulp = require('gulp')
const awspublish = require('gulp-awspublish')
const awspublishRouter = require("gulp-awspublish-router");
const cloudfront = require('gulp-cloudfront-invalidate-aws-publish')
const parallelize = require('concurrent-transform')
// https://docs.aws.amazon.com/cli/latest/userguide/cli-environment.html
const config = {
// Required
export SENDPOST_API_KEY='YOUR_API_KEY'
@karngyan
karngyan / cpp17errichto.sublime-build
Created September 12, 2020 13:04
C++ Competitive Programming Sublime 3 Build + Terminus + Sanitizers
{
"target": "terminus_exec", // "terminus_open" - if using this you dont need cancel, simply close tab and watch this: https://youtu.be/etIJMVIvVgg
"cancel": "terminus_cancel_build",
"focus": false,
"timeit": true,
"shell_cmd": "g++ -std=c++17 -Wshadow -Wall -o \"${file_path}/${file_base_name}.o\" \"${file}\" -O2 -Wno-unused-result",
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
#include<stdlib.h>
#include<stdio.h>
#include<sys/time.h>
#define n 4096
#define THRESHOLD 32
double A[n][n];
double B[n][n];
double C[n][n];
#include<stdlib.h>
#include<stdio.h>
#include<sys/time.h>
#define n 4096
double A[n][n];
double B[n][n];
double C[n][n];
import java.util.Random;
public class MatrixMultiply {
static int n = 4096;
static double[][] A = new double[n][n];
static double[][] B = new double[n][n];
static double[][] C = new double[n][n];
public static void main(String[] args) {
Random random = new Random();
import sys, random
from time import time
n = 4096
A = [[random.random()
for row in range(n)]
for col in range(n)]
B = [[random.random()
//g++ 7.4.0
/*
* Min Sparse Table Example
*
* @author Karn, mail@karngyan.com
*/
#include <bits/stdc++.h>
@karngyan
karngyan / majorit_element.cpp
Last active April 29, 2020 13:13
Majority_Element_Divide_n_Conquer
/*
Author: @karngyan
Team: BlundersPride
*/
#include<bits/stdc++.h>