Skip to content

Instantly share code, notes, and snippets.

@vinayakg
vinayakg / expectations-guidelines-heartathon.md
Created July 19, 2024 09:05
Expectation setting/Guidelines of the hackathon

Expectation setting/Guidelines of the hackathon

  • There is no prize money for this hackathon
  • All participants are expected to work on the problem statements shared by the organizers. Other problem statements will be validated by the organizers and accordingly scheduled
  • Form Group of min 1 and max 4 participants
  • Each group will be working on a pre-defined Problem Statement assisted by a mentor
  • Group can reach out to Mentor for any clarifications
  • Participants are expected to build a workable solution for the problem statement chosen. The organizing committee will reach out later to plug any gaps/platformize the solution if needed
@vinayakg
vinayakg / code-of-conduct-heartathon.md
Created July 19, 2024 09:01
Code of Conduct - Heartathon

Code of Conduct - Heartathon

Heartathon is a community event intended for learning, collaboration, and engagement in the Heartfulness Technology community. We value the participation of each member of the community and want everyone involved to have an enjoyable and fulfilling experience.

Accordingly, all members are expected to show respect and courtesy to others throughout the event. To make clear what is expected - all participants, mentors and volunteers in the hackathon are required to conform to the following Code of Conduct.

Be Respectful: Be kind to others. Do not insult or put down other attendees. Behave professionally. Remember that harassment and racist, sexist, or exclusionary jokes are not appropriate for this event. Harassment includes offensive verbal comments related to gender, sexual orientation, disability, physical appearance, body size, race, religion, deliberate intimidation, stalking, following, harassing photography or recording, sustained disruption of talks or other

@vinayakg
vinayakg / oauth-flow.wsd
Last active July 10, 2024 15:22
OAuth Flow
@startuml
[Web Browser] --> [Service Provider] : Get /my-data
[Service Provider] --> [Web Browser]: Permit to authenticate with identity.com/oauth?
[Web Browser] --> [Identity Provider]: Can you authenticate me, use clientid, scope and give me Auth code
[Identity Provider] --> [Web Browser]: You are authenticated, authcode `code`
[Web Browser] -->[Service Provider]: Please use the code and fetch details
[Service Provider] -->[Identity Provider]: Use auth code, clientid, client secret and return access token
[Identity Provider]-->[Service Provider]: Take the access token
@vinayakg
vinayakg / demography_analyzer.py
Last active May 15, 2024 16:08
demography analyzer
import pandas as pd
def calculate_demographic_data(print_data=True):
# Read data from file
df = pd.read_csv("boilerplate-demographic-data-analyzer/adult.data.csv")
# How many of each race are represented in this dataset? This should be a Pandas series with race names as the index labels.
# How many people of each race are represented in this dataset? This should be a Pandas series with race names as the index labels. (race column)
race_count = df["race"].value_counts()
@vinayakg
vinayakg / mean_std_var.py
Last active May 13, 2024 12:57
Mean-Variance-Standard Deviation Calculator
import numpy as np
def calculate(lst):
if len(lst) != 9:
raise ValueError("List must contain nine numbers.")
arr = np.array(lst)
reshapedarr = arr.reshape(3, 3)
@vinayakg
vinayakg / pgsql-mysql-fdw-data.sql
Last active April 6, 2024 14:21
CDC MYSQL PGSQL
-- STEP 2
-- All these commands in sequence can be run from psql or dbeaver et al
-- create extension
create extension mysql_fdw;
-- create remote server
CREATE SERVER mysql_server FOREIGN DATA WRAPPER mysql_fdw OPTIONS (host 'localhost', port '3306');
@vinayakg
vinayakg / CVE-2024-3094-checker.sh
Last active March 31, 2024 07:43
xz-vulnerability-check
#!/bin/bash
# Its a fork of code available at https://github.com/FabioBaroni/CVE-2024-3094-checker/blob/ebd22e6e2943cf56af7032324f17cf589aafc09b/CVE-2024-3094-checker.sh
# Added commands for MacOS
# script to detect CVE-2024-3094
# original script:
# https://www.openwall.com/lists/oss-security/2024/03/29/4
@vinayakg
vinayakg / LRU.java
Created March 24, 2024 14:14
LRU-CACHE
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ThreadLocalRandom;
public class LRU {
// Modulus for HashMap Keys, i.e. Range (0, 9)
final static int LIMIT = 10;
// Evict the least recently used, once the load factor is reached.
@vinayakg
vinayakg / xlsxreadcount.js
Created March 24, 2024 13:03
count rows xlsx
const XLSX = require('xlsx');
const fs = require('fs');
const path = require('path');
const { createHash } = require('crypto');
let overallRowCount = 0;
try {
// Function to count rows in a single .xlsx file
const countRows = (filePath) => {
try {
@vinayakg
vinayakg / pgsql-encryption.sql
Created March 24, 2024 13:02
pgsql encryption
CREATE OR REPLACE FUNCTION en_cols()
RETURNS trigger AS
$$
DECLARE
continue_exception BOOLEAN;
assignable text;
BEGIN
continue_exception := TRUE;
PERFORM set_config('log_statement', 'none', true);
BEGIN