Skip to content

Instantly share code, notes, and snippets.

View harisarang's full-sized avatar
🧵
Threading

Harisaran G harisarang

🧵
Threading
View GitHub Profile
from scipy.spatial import distance
class Vectors:
def __init__(self, dimensions):
self.vectors = []
self.dimensions = dimensions
def add_vector(self, vector):
self.vectors.append(vector)
package main
import (
"fmt"
"io"
"strings"
"github.com/typesense/typesense-go/typesense"
)
@harisarang
harisarang / projects.json
Created October 30, 2021 06:03
Appwrite Project collection
{
"$id": "your-collection-id",
"$permissions": {
"read": [
"*"
],
"write": [
"*"
]
},
@harisarang
harisarang / mutex-counter.go
Created July 1, 2021 03:06
Mock web crawler
package main
import (
"fmt"
"sync"
)
type Fetcher interface {
// Fetch returns the body of URL and
// a slice of URLs found on that page.
@harisarang
harisarang / bst_check.go
Created June 30, 2021 15:16
Exercise: Equivalent Binary Trees (A Tour of Go)
package main
import "fmt"
import "golang.org/x/tour/tree"
// Walk walks the tree t sending all values
// from the tree to the channel ch.
func walk(t *tree.Tree, ch chan int) {
if t.Left != nil {
walk(t.Left, ch)
#include<iostream>
using namespace std;
struct BST {
int k;
BST *left;
BST *right;
};
class SplayTree {
@harisarang
harisarang / bubble_sort.cpp
Last active May 5, 2021 06:13
Bubble Sort using templates
#include<iostream>
using namespace std;
template<class T>
T* bubbleSort(T* v, int n) {
for(int i = 0; i < n - 1; ++i) {
for(int j = 0; j < n - i - 1; ++j) {
if(v[j] > v[j + 1]) {
float temp = v[j];
v[j] = v[j + 1];
{
"cmd": "g++ -std=c++17 $file_name -o exe && timeout 10s ./exe </home/thirusenthil/CP/in.txt > /home/thirusenthil/CP/out.txt",
"selector": "source.c++",
"shell": true,
"working_dir" : "$file_path"
}
#include<stdio.h>
#include<stdlib.h>
struct node
{
char info;
struct node *ptr;
}*front,*rear,*temp,*front1, *prevFront;
void enq(char data);
#include<stdio.h>
#include<string.h>
//Check if palindrome
char queue[100];
int front= -1;
int rear= -1;
int enqueue(char c){
if(front==-1&&rear==-1){
front=rear=0;
}