This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// fread wrapper with error checking | |
static void fread_e(void *output, size_t size, size_t n, FILE *file) { | |
size_t num_read_items = fread(output, size, n, file); | |
if (num_read_items != n) { | |
if (ferror(file)) { | |
throw std::runtime_error("Error reading file"); | |
} else if (feof(file)) { | |
throw std::runtime_error("EOF found"); | |
} else { | |
throw std::runtime_error("Unknown file error"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
make lite ninja ccache BUILD_CMAKE_ARGS="-DWITH_GHOST_SDL=ON -DWITH_SDL=ON -DCMAKE_BUILD_TYPE=Release" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
wget https://www.x.org/archive/individual/proto/xproto-7.0.31.tar.gz | |
tar xvfz xproto-7.0.31.tar.gz | |
cd xproto-7.0.31 | |
./configure --prefix=/data/data/com.termux/files/usr/local/xproto/7_0_31 --build=aarch64-unknown-linux-gnu | |
make | |
make install | |
# Export before building vscode for example | |
export PKG_CONFIG_PATH=/data/data/com.termux/files/usr/local/xproto/7_0_31/lib/pkgconfig/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
inline bool is_tet_positive(const Vec3 &a, const Vec3 &b, const Vec3 &c, const Vec3 &d) | |
{ | |
return (a - d).dot((b - d).cross(c - d)) > 0; | |
} | |
inline bool do_intersect_segment_tri(const Vec3 &segment_a, | |
const Vec3 &segment_b, | |
const Vec3 &tri_a, | |
const Vec3 &tri_b, | |
const Vec3 &tri_c) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt install llvm-12 clang-12 libclang-12-dev | |
git clone https://github.com/illuhad/hipSYCL | |
mkdir hipSYCL_build | |
cd hipSYCL_build | |
cmake ../hipSYCL -DWITH_ROCM_BACKEND=ON -DLLVM_DIR=/opt/rocm/llvm/lib/cmake/llvm/ | |
sudo make install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
non_manifold_verts = [v for v in bm.verts if not v.is_manifold] | |
for v in non_manifold_verts: | |
bmesh.utils.vert_separate(v, v.link_edges) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can ofcourse adapt this to QSpinBox | |
# And also use PyQt instead of PySide | |
from PySide2.QtWidgets import QDoubleSpinBox | |
from PySide2.QtGui import QValidator | |
class ClampedDoubleSpinbox(QDoubleSpinBox): | |
def validate(self, text: str, pos: int) -> QValidator.State: | |
try: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
// Reference https://www.asciitable.com/ | |
const char *special_codes[] = { | |
"null", | |
"start of heading", | |
"start of text", | |
"end of text", | |
"end of transmission", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def sum_digits(number: int): | |
s = 0 | |
while (number > 0): | |
d = number % 10 | |
s += d | |
number //= 10 | |
return s |