Skip to content

Instantly share code, notes, and snippets.

View neeraj9's full-sized avatar
🎯
Focusing

Neeraj neeraj9

🎯
Focusing
  • Microsoft
View GitHub Profile
@neeraj9
neeraj9 / dirlist_simple.c
Created December 2, 2025 20:48
C code to list list directories and files with size on Linux simpler version
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <dirent.h>
#include <sys/stat.h>
#include <limits.h>
typedef struct {
off_t total;
int depth;
@neeraj9
neeraj9 / dirworth.c
Last active December 2, 2025 20:23
List files and folders with sizes on Linux
#define _XOPEN_SOURCE 500
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ftw.h>
#include <sys/stat.h>
static off_t total_size = 0;
static off_t total_symbolic_links = 0;
static off_t total_directories_visited = 0;
@neeraj9
neeraj9 / upscaler.py
Created November 19, 2025 05:16 — forked from mq1n/upscaler.py
Topaz Photo AI CLI Sample with Python Automated Script & DDS Support
import os, sys, subprocess
try:
from wand.image import Image
except ImportError:
os.system('python -m pip install wand')
from wand.image import Image
def main(args):
if len(args) < 1:
print('Usage: upscaler.py <input_image> [output_image]')
@neeraj9
neeraj9 / simple-meson-build-for-cpp-project.build
Created October 25, 2023 04:37
A simple build script in Meson for main.cpp and an include folder
project('myapp', 'cpp',
default_options : ['cpp_std=c++20', 'warning_level=2'])
main_target_name = 'myapp'
sources = ['src/main.cpp', 'src/common.cpp']
hdrs = include_directories('include')
executable(main_target_name, sources,
include_directories : hdrs,
install : true)
@neeraj9
neeraj9 / list-directory-recursively.zig
Created October 25, 2023 04:02
List directory recursively in Zig programming language
const std = @import("std");
pub fn main() !void {
var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined;
const cwd = std.os.getcwd(&buf) catch |err| {
std.debug.print("> [error] detecting current working directory, err={}\n", .{err});
return;
};
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
@neeraj9
neeraj9 / building-carbon-explorer-on-ubuntu.sh
Created October 24, 2023 13:22
building carbon explorer from source on ubuntu
# see https://github.com/carbon-language/carbon-lang#getting-started
mkdir carbon-language
cd carbon-language
git clone https://github.com/carbon-language/carbon-lang
bazel run //explorer -- ./explorer/testdata/print/format_only.carbon
@neeraj9
neeraj9 / ubuntu-deps-for-carbon-compiler.sh
Created October 24, 2023 13:14
Ubuntu installation dependencies for Carbon programming compiler
# see https://github.com/carbon-language/carbon-lang#getting-started
sudo apt install build-essential bazel-bootstrap llvm
@neeraj9
neeraj9 / ubuntu-deps-for-zig-compiler-build-from-source.sh
Created October 24, 2023 06:45
Install Ubuntu dependencies for Zig compiler build from source
# see https://github.com/ziglang/zig-bootstrap#host-system-dependencies
sudo apt install build-essential cmake ninja-build make python3
@neeraj9
neeraj9 / building-zig-compiler-from-source-on-ubuntu-linux.sh
Last active October 24, 2023 06:40
Building zig compiler from source on Ubuntu Linux
# Building open source software from source code is always interesting
# although time consuming at times.
# Make sure that your system has CMake, Ninja, GCC (c, c++) compiler, Python 3 installed.
# see https://github.com/ziglang/zig-bootstrap#host-system-dependencies
cd $HOME
mkdir ziglang
cd ziglang
@neeraj9
neeraj9 / effective_modern_cmake.md
Created June 4, 2023 18:38 — forked from mbinna/effective_modern_cmake.md
Effective Modern CMake

Effective Modern CMake

Getting Started

For a brief user-level introduction to CMake, watch C++ Weekly, Episode 78, Intro to CMake by Jason Turner. LLVM’s CMake Primer provides a good high-level introduction to the CMake syntax. Go read it now.

After that, watch Mathieu Ropert’s CppCon 2017 talk Using Modern CMake Patterns to Enforce a Good Modular Design (slides). It provides a thorough explanation of what modern CMake is and why it is so much better than “old school” CMake. The modular design ideas in this talk are based on the book [Large-Scale C++ Software Design](https://www.amazon.de/Large-Scale-Soft