Skip to content

Instantly share code, notes, and snippets.

View ganesh-k13's full-sized avatar
🪄

Ganesh Kathiresan ganesh-k13

🪄
View GitHub Profile
@ganesh-k13
ganesh-k13 / overflow.py
Last active May 14, 2022 13:42
NumPy division overflow tests
import itertools
import numpy as np
from subprocess import Popen, PIPE
from pprint import pprint
from tqdm import tqdm
@ganesh-k13
ganesh-k13 / numpy-distutils-_compiler_config.yaml
Created February 20, 2022 13:33
BLD, ENH: Display compiler configuration in show_config #20939
c_compiler:
_auto_depends: true
archiver: &id001
- x86_64-linux-gnu-ar
- rcs
compiler: &id002
- x86_64-linux-gnu-gcc
- -pthread
- -Wno-unused-result
- -Wsign-compare
# https://github.com/gpakosz/.tmux
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
# without any warranty.
# Copyright 2012— Gregory Pakosz (@gpakosz).
# -- navigation ----------------------------------------------------------------
# if you're running tmux within iTerm2
# - and tmux is 1.9 or 1.9a
@ganesh-k13
ganesh-k13 / lockDecorator.py
Created October 16, 2021 16:21
Locking decorator in python
# imports
import threading
import typing
import functools
# Constants
class LockConstants:
PRINTLOCK = threading.Lock()
SOMEOTHERLOCK = threading.Lock()

Usage:

g++ -g tree.cpp # For random alloc
g++ -g tree.cpp -DUSE_ARENA # For continious
@ganesh-k13
ganesh-k13 / comparision.py
Last active February 4, 2021 17:05
Numpy snippetes
import numpy as np
c16 = np.complex128()
f16 = np.float128()
f8 = np.float64()
i8 = np.int64()
u8 = np.uint64()
c8 = np.complex64()
f4 = np.float32()
@ganesh-k13
ganesh-k13 / README.md
Last active October 18, 2020 16:25
Excel images to ppt

Install pptx

pip install python-pptx

Run:

usage: parse.py [-h] --xls XLS --pptx PPTX

Process some integers.

optional arguments:
@ganesh-k13
ganesh-k13 / sol.py
Created October 10, 2020 16:30
Minimum Number of Arrows to Burst Balloons Solution
class Solution:
def findMinArrowShots(self, points: List[List[int]]) -> int:
if points == []:
return 0
points.sort(key = lambda p: p[1])
res = 1
cur_top = points[0][1]
for point in points:
if point[0] <= cur_top:
continue
@ganesh-k13
ganesh-k13 / Makefile
Last active July 4, 2020 08:47
Function hijacking in c
CHECK := $(shell which clang)
ifeq ($(CHECK),)
$(warning no clang found, consider apt-get install clang, using gcc now)
CC = gcc
else
$(info using clang over gcc)
CC = clang
endif
#include <unistd.h>
#include <iostream>
#include <thread>
int getNumberOfCPUs(void)
{
unsigned concurentThreadsSupported = std::thread::hardware_concurrency();
// std::cout << "Thread: " << concurentThreadsSupported << std::endl;
#if defined _WIN32
SYSTEM_INFO sysinfo;