Skip to content

Instantly share code, notes, and snippets.

View naveen521kk's full-sized avatar
💭
Focusing!

Naveen M K naveen521kk

💭
Focusing!
View GitHub Profile
@naveen521kk
naveen521kk / useful-commands.md
Last active November 29, 2023 13:30
I've collected a list of usefull commands which I can't usually remember top of my head

Compress a tar archive:

tar -czvf name-of-archive.tar.gz /path/to/directory-or-file

Extract a tar archive

tar -xf name-of-archive.tar.gz outdir/
@naveen521kk
naveen521kk / change-size-insta-curr-dir.py
Last active January 31, 2024 13:14
A program to make an image as a square maintaining aspect ratio and fill white spaces for extra space.
# A program to make an image as a square maintaining aspect ratio and fill white spaces for extra space.
# I used this for instagram posts
from PIL import Image
import os
from pillow_heif import register_heif_opener
register_heif_opener()
# find largest width and length
@naveen521kk
naveen521kk / matrix.c
Last active April 23, 2022 14:52
A basic C programs for using 2D arrays and doing matrix operations
#include <stdio.h>
#include <stdlib.h>
int main() {
int row, col;
printf("enter row and col:");
scanf("%d %d", &row, &col);
int **mat;
mat = calloc(row, sizeof(int *));
@naveen521kk
naveen521kk / binary-search.py
Last active March 24, 2022 17:31
Programs for Semester 1
def binary_search(arr, low, high, number):
if high >= low:
mid = (high + low) // 2
if arr[mid] == number:
return mid
elif arr[mid] > number:
return binary_search(arr, low, mid - 1, number)
else:
return binary_search(arr, mid + 1, high, number)
else:
#!/bin/bash
set -e
INSTALLER_URL="http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz"
tmpdir=$(mktemp -d)
mkdir -pv $tmpdir
echo "Cding into temp directory $tmpdir"
cd $tmpdir
@naveen521kk
naveen521kk / detect-mingw.py
Last active March 24, 2022 13:48
A program to check if the compiler passed is a Mingw-w64 based compiler.
# A program to check if the compiler passed
# is a Mingw-w64 based compiler.
import os
import subprocess
import argparse
import sys
def is_mingw(CC):
@naveen521kk
naveen521kk / moderngl.ipynb
Last active August 10, 2021 12:39
Moderngl.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@naveen521kk
naveen521kk / gen-headers.py
Last active May 9, 2021 19:36
Kpathsea compile meson windows
import sys
normal_headers = [
"absolute.h",
"c-ctype.h",
"c-dir.h",
"c-errno.h",
"c-fopen.h",
"c-limits.h",
"c-memstr.h",
"c-minmax.h",
@naveen521kk
naveen521kk / cybertruck.py
Last active March 13, 2022 17:09
Manimce OpenGL displaying a Cybertruck
# Works on Manim Community Edition v0.15.0
from manim import *
from manim.opengl import *
import textwrap
class InlineFullScreenQuad(Scene):
def construct(self):
surface = FullScreenQuad(
self.renderer.context,
textwrap.indent("""
@naveen521kk
naveen521kk / no_common_element_list.py
Last active April 30, 2021 05:11
Check for common elements in a list
def no_common_element_list(a,b):
return set(a) - set(b) == set(a) and set(b) - set(a) == set(b)