Skip to content

Instantly share code, notes, and snippets.

View namandixit's full-sized avatar
➡️
Guided by PointeSEGMENTATION FAULT

Naman Dixit namandixit

➡️
Guided by PointeSEGMENTATION FAULT
View GitHub Profile
@namandixit
namandixit / CONDUCT.md
Created September 15, 2024 06:54
Code of conduct from Opal repository (https://github.com/opal/opal/blob/master/CONDUCT.md)

This document provides community guidelines for a safe, respectful, productive, and collaborative place for any person who is willing to contribute to the Opal community. It applies to all “collaborative space”, which is defined as community communications channels (such as mailing lists, submitted patches, commit comments, etc.).

  • Participants will be tolerant of opposing views.
  • Participants must ensure that their language and actions are free of personal attacks and disparaging personal remarks.
  • When interpreting the words and actions of others, participants should always
@namandixit
namandixit / code.md
Created September 10, 2024 04:35
Sample statically-typed prototype-based OOP

Statically typed prototype-based OOP

I did not come up with this. I found this in a Pastebin linked from a Hacker News comment, and I was never able to find either the comment or the paste ever again. Thus, I am unable to credit whoever did come up with it. If someone knows the source, please let me know.

# object "ex nihilo"

var a = object {
@namandixit
namandixit / x-www-browser
Created September 10, 2024 03:57
Make WebHTTrack work inside Distrobox
#!/usr/bin/env bash
# Replace /usr/bin/x-www-browser with this script to make webhttrack work properly inside a Distrobox
# extract the protocol
proto="$(echo $1 | grep :// | sed -e's,^\(.*://\).*,\1,g')"
# remove the protocol -- updated
url=$(echo $1 | sed -e s,$proto,,g)
# extract the user (if any)
user="$(echo $url | grep @ | cut -d@ -f1)"
@namandixit
namandixit / omg.md
Created March 2, 2023 09:01
Our Machinery Guidebook

The purpose of this guidebook is to lay down principles and guidelines for how to write code and work together at Our Machinery.

OMG-META: About this guidebook

OMG-META-1: Guidelines are identified by unique identifiers

Each guideline in this document is identified by a unique identifier (OMG-META-1) as well as a name (Guidelines are identified by unique identifiers). Names may change, but identifiers are permanent and can be used to permanently and uniquely refer to a specific guideline.

@namandixit
namandixit / c++_notes.txt
Created March 11, 2022 08:59
C++ notes (for placement)
1. std::set is a sorted container
set<int> S;
S.insert(1);
S.insert(3);
S.insert(2);
auto I = S.find(2); // Returns an iterator
assert(*(I - 1) == 1);
assert(*(I + 1) == 3);
@namandixit
namandixit / qbittorent_export.py
Last active September 13, 2024 09:12
QBittorent backup all torrent files
#!/usr/bin/env python3
import libtorrent as lt
import sys
import os
# Location of torrent files: https://github.com/qbittorrent/qBittorrent/wiki/Frequently-Asked-Questions#Where_does_qBittorrent_save_its_settings
os.chdir('BT_backup')
dirname = '.'
/* NOTE(naman): Description of current Audio system.
--------------------------------------------------------------------
We have two positions inside the audio buffer: play_cursor and
write_cursor. The play_cursor signals what bytes are currently
being played by the audio hardware (well...) while the write_cursor
signals where in the audio buffer is it safe to write new data.
MSDN says that write_cursor is usually ahead of the play_cursor
by about 15 ms. As the audio gets played, both these positions
@namandixit
namandixit / math3d.h
Last active August 17, 2023 11:46
3D Linear Algebra Library in C99 (Tested with OpenGL)
/* This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit