Skip to content

Instantly share code, notes, and snippets.

View adamkewley's full-sized avatar

Adam Kewley adamkewley

View GitHub Profile
#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
@adamkewley
adamkewley / opensim-creator_661_repro.osim
Created February 23, 2023 15:27
An OpenSim4 osim file that segfaults after the model is copy-constructed. Crashes on-load in OpenSim Creator, and on running a forward-dynamic simulation in OpenSim GUI.
<?xml version="1.0" encoding="UTF-8" ?>
<OpenSimDocument Version="40000">
<Model name="model">
<!--The model's ground reference frame.-->
<Ground name="ground">
<!--The geometry used to display the axes of this Frame.-->
<FrameGeometry name="frame_geometry">
<!--Path to a Component that satisfies the Socket 'frame' of type Frame.-->
<socket_frame>..</socket_frame>
<!--Scale factors in X, Y, Z directions respectively.-->
@adamkewley
adamkewley / CMakeSettings.json
Created February 14, 2023 12:17 — forked from mluparu/CMakeSettings.json
CMake in Visual Studio: MinGW configuration targeting both x64 and i686
{
"configurations": [
{
"environments": [
{
"MINGW64_ROOT": "C:\\msys64\\mingw64",
"BIN_ROOT": "${env.MINGW64_ROOT}\\bin",
"FLAVOR": "x86_64-w64-mingw32",
"TOOLSET_VERSION": "7.3.0",
"INCLUDE": "${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION};${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\tr1;${env.MINGW64_ROOT}\\include\\c++\\${env.TOOLSET_VERSION}\\${env.FLAVOR}",
@adamkewley
adamkewley / simplified_opensim_build_guide.ps1
Last active January 18, 2023 09:17
A simplified version of the opensim-core build instructions, for C++ developers.
# this is a semi-manual guide for setting up a Visual Studio 2022-based
# development environment for opensim-core
#
# you can run the script, but it only builds OpenSim's dependencies - you
# have to manually set up Visual Studio because it has in-built CMake support
#
# before doing this you need to install:
#
# - CMake (https://cmake.org/download/)
# - Git (https://git-scm.com/downloads)