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 / 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

@neeraj9
neeraj9 / docker-intro-session-ex-1.ps1
Created April 16, 2023 04:08 — forked from jamesattard/docker-intro-session-ex-1.ps1
Docker Intro Session Exercise #1
# In this exercise we are going through the Docker fundamental commands.
# After completing this lab, you are expected to know how to:
#
# a. find Docker images
# b. run containers
# c. stop containers
# d. delete containers
#
# Docker Intro Session Lab - James Attard (2019)
@neeraj9
neeraj9 / Find-SDKTool.ps1
Created April 16, 2023 04:07 — forked from JeffJacobson/Find-SDKTool.ps1
A script that finds different versions of Windows .NET SDK tools in expected directories.
<#
.SYNOPSIS
Finds an SDK tool in .NET SDK folders
.INPUTS
Name of tool (exe filename) to search for. (E.g., svcutil.exe)
.OUTPUTS
Outputs a list of matching filenames along with properties about the directories
* Windows SDK version
* .NET version
* 32- or 64-bit exe
@neeraj9
neeraj9 / findlinks.c
Created April 16, 2023 04:07 — forked from juntalis/findlinks.c
Find hard links for a given filepath