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 / code.md
Last active October 8, 2024 03:42
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 {
    x: 7,
@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
Last active March 12, 2025 02:57
Our Machinery Guidebook (Mirrored from https://ourmachinery.com/files/guidebook.md.html)

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 / nextcloud-kde-startup.sh
Created March 11, 2022 09:05
NextCloud Startup Helper on KDE
#!/bin/bash
#
# See https://github.com/nextcloud/desktop/issues/1011
#
############################################
# Adjust the following to suit your needs
WALLET="kdewallet" # Name of wallet storing nextcloud client password
MAX_TRIES=2 # Max. number of tries to ask for password
############################################
i=0
@namandixit
namandixit / savebackup.sh
Created March 11, 2022 09:03
Backup save games from Steam Proton
#!/usr/bin/env bash
${HOME}/.local/share/Steam/steamapps/compatdata/shared-user.sh
#${HOME}/.local/bin/Proton-GE/compatdata/shared-user.sh
cp -ru "${HOME}/.local/share/Steam/steamapps/compatdata/userdata" "${HOME}/Bin/Games/PC/Saves/SteamProton"
#cp -rn "${HOME}/.local/bin/Proton-GE/compatdata/userdata" "${HOME}/Bin/Games/PC/Saves/UserProton"
@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