Skip to content

Instantly share code, notes, and snippets.

View anuradhawick's full-sized avatar
:octocat:
Hello there :)

Anuradha anuradhawick

:octocat:
Hello there :)
View GitHub Profile
@anuradhawick
anuradhawick / MyHashTable.rs
Created May 15, 2024 03:27
A simple concurrent hash table in Rust
use std::collections::HashMap;
use std::sync::{RwLock, Arc};
use std::sync::atomic::{AtomicU32, Ordering};
use std::cell::UnsafeCell;
struct MyHashTable {
map: RwLock<UnsafeCell<HashMap<u64, AtomicU32>>>,
}
impl MyHashTable {
@anuradhawick
anuradhawick / 60.py
Created December 15, 2023 06:59
Euler 60
import math
from tqdm import tqdm
from functools import cache
from collections import defaultdict
def sieve_of_Sundaram(n):
"""The sieve of Sundaram is a simple deterministic algorithm for finding all the prime numbers up to a specified integer."""
k = (n - 2) // 2
integers_list = [True] * (k + 1)
@anuradhawick
anuradhawick / 51.py
Created December 15, 2023 06:58
Euler 51
import math
from collections import Counter
def get_masks(size):
vals = []
for x in range(1, 10**size):
val = bin(x)[2:]
if len(val) > size:
return vals
@anuradhawick
anuradhawick / face_recognition.ipynb
Last active December 5, 2022 12:24
Face recognition example notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anuradhawick
anuradhawick / boost_popcnt.hpp
Created July 19, 2022 01:47
Boost population count on multiprecision ints
/*
Credits to the original author in the post from StackOverflow: https://stackoverflow.com/questions/24824681/how-do-i-get-the-population-count-of-an-unsigned-unchecked-number-with-boostmu
*/
#include <bitset>
#include <limits>
#include <type_traits>
#include <boost/multiprecision/cpp_int.hpp>
@anuradhawick
anuradhawick / AbstractFactory.py
Created September 26, 2021 02:16
Abstract Factory Design pattern
class User:
def __init__(self, *args, **kwards):
self.store = args
self.key_store = kwards
def __str__(self):
output = 'Values\n-------\n'
for v in self.store:
output += str(v) + '\n'
@anuradhawick
anuradhawick / Factory.py
Created September 26, 2021 01:56
Factory Design Pattern
class User:
def __init__(self, *args, **kwards):
self.store = args
self.key_store = kwards
def __str__(self):
output = 'Values\n-------\n'
for v in self.store:
output += str(v) + '\n'
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anuradhawick
anuradhawick / GCN Cora.ipynb
Last active August 6, 2025 07:01
GCN Cora
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@anuradhawick
anuradhawick / attendance_sheet_maker.py
Created August 1, 2021 02:42
Gather CSV file(s) into XLSX Sheets
import csv
import pandas as pd
from collections import defaultdict
header = None
created_sheets = defaultdict(list)
lc = None
with open('INPUT.csv') as f:
reader = csv.reader(f)