Skip to content

Instantly share code, notes, and snippets.

View adamkewley's full-sized avatar

Adam Kewley adamkewley

View GitHub Profile
@adamkewley
adamkewley / build_opynsim_for_cpp_projects.sh
Created January 21, 2026 08:55
Build OPynSim into an install root for throwaway C++ projects
# !!!! WARNING: THIS ISN'T OFFICIAL IN ANY WAY: DON'T COME CRYING TO ME IF YOUR C++ BREAKS !!!!
# # Before: get source code and enter directory:
# git clone https://github.com/opynsim/opynsim
# cd opynsim
build_type=Release
build_dir=${PWD}/build
install_dir=${PWD}/install
@adamkewley
adamkewley / build_osc_install.sh
Last active January 13, 2026 15:49
Build OpenSim Creator for downstream C++ projects
# !!!! WARNING: THIS ISN'T OFFICIAL IN ANY WAY: DON'T COME CRYING TO ME IF YOUR C++ BREAKS !!!!
# # Before: get source code and enter directory:
#
# git clone https://github.com/ComputationalBiomechanicsLab/opensim-creator
# cd opensim-creator/
build_type=Release
build_dir=${PWD}/build
install_dir=${PWD}/install
void prompt_user_to_select_file_async(
std::function<void(FileDialogResponse)> callback,
std::span<const FileDialogFilter> filters,
std::optional<std::filesystem::path> initial_directory_to_show,
bool allow_many)
{
// State that's stored in the sdl3 callback.
struct SDL3CallbackState final {
// Constructs the callback state that's stored in SDL3's dialog system.
explicit SDL3CallbackState(
#include <oscar/oscar.h>
#include <charconv>
#include <filesystem>
#include <fstream>
#include <regex>
#include <sstream>
#include <stdexcept>
#include <string_view>
#include <span>
<?xml version="1.0" encoding="utf-8" ?>
<OpenSimDocument Version="40000">
<ModelWarperConfiguration>
<!-- `OffsetFrameWarpingStrategy`s used to warp specific frames in the model. A `StrategyTarget`
of `*` can be used as a lowest-priority wildcard to specify which strategy the warping engine
should use when it cannot find a more specific one for a given `OpenSim::PhysicalOffsetFrame`
in the model -->
<OffsetFrameWarpingStrategies>
83,95c83,84
< /**
< * Default constructor.<br>
< * <br>
< * @param aDefaultValue Default value of an array element. This value<br>
< * is used to initialize array elements as the size of the array is<br>
< * changed.<br>
< * @param aSize Initial size of the array. The array elements are<br>
< * initialized to aDefaultValue.<br>
< * @param aCapacity Initial capacity of the array. The initial capacity<br>
def f(n):
result = 0
for i in range(n):
result += i * i
return result
def slow_function():
result1 = f(100000)
result2 = ''
for i in range(10000):
import random
import unittest
def _binary_search_from_pivot(lst, el, pivot_point):
# returnss.......
# - another range to searach
# - the answer
pass
def binary_search(lst, el):
opensim-models/Models/WalkerModel/WalkerModelTerrain.osim
Indirect leak of 8640 byte(s) in 40 object(s) allocated from:
#0 0x7f5419be01e7 in operator new(unsigned long) ../../../../src/libsanitizer/asan/asan_new_delete.cpp:99
#1 0x7f5414235061 in SimTK::Xml::Element::Element(SimTK::String const&, SimTK::String const&) /home/adam/opensim-core/dependencies/simbody/SimTKcommon/src/Xml.cpp:696
#2 0x7f5417ae916e in OpenSim::ContactGeometry::updateFromXMLNode(SimTK::Xml::Element&, int) /home/adam/opensim-core/OpenSim/Simulation/Model/ContactGeometry.cpp:160
#3 0x7f541686d2f6 in OpenSim::Object::updateFromXMLNode(SimTK::Xml::Element&, int) /home/adam/opensim-core/OpenSim/Common/Object.cpp:954
#4 0x7f54166b9a28 in OpenSim::Component::updateFromXMLNode(SimTK::Xml::Element&, int) /home/adam/opensim-core/OpenSim/Common/Component.cpp:1200
#5 0x7f5417eba5b5 in OpenSim::ModelComponent::updateFromXMLNode(SimTK::Xml::Element&, int) /home/adam/opensim-core/OpenSim/Simulation/Model/ModelComponent.cpp:1
@adamkewley
adamkewley / ICM20948.py
Created March 2, 2023 20:26
ICM20948.py used in PBL lab
#!/usr/bin/python
# -*- coding:utf-8 -*-
import time
import smbus
import math
Gyro = [0,0,0]
Accel = [0,0,0]
Mag = [0,0,0]
pitch = 0.0
roll = 0.0