This file contains hidden or 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
| from transformers import AutoProcessor, Blip2ForConditionalGeneration | |
| from PIL import Image | |
| import torch | |
| the_device = "cpu" | |
| if torch.backends.mps.is_available(): | |
| the_device = "mps" | |
| elif torch.cuda.is_available(): | |
| the_device = "cuda" |
This file contains hidden or 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> | |
| #include <vector> | |
| #include <cstdint> | |
| #include <cstring> | |
| bool isStartCode3(const uint8_t* p) | |
| { | |
| return p[0] == 0x00 && p[1] == 0x00 && p[2] == 0x01; | |
| } |
This file contains hidden or 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(FetchContent) | |
| FetchContent_Declare( | |
| googletest | |
| GIT_REPOSITORY https://github.com/google/googletest.git | |
| GIT_TAG v1.14.0 | |
| ) | |
| FetchContent_MakeAvailable(googletest) | |
| add_executable(mytests |
This file contains hidden or 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 <lame/lame.h> | |
| struct Mp3Encoder { | |
| lame_global_flags *lame = nullptr; | |
| ~Mp3Encoder() { | |
| if (lame) { | |
| lame_close(lame); | |
| lame = nullptr; | |
| } | |
| } |
This file contains hidden or 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> | |
| #ifdef __ARM_NEON | |
| #include <arm_neon.h> | |
| #endif | |
| #include <fstream> |
This file contains hidden or 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
| void string_split(const std::string &s, const std::string &delim, std::deque<std::string> &out, int maxElements) { | |
| auto start = 0U; | |
| auto end = s.find(delim); | |
| while (end != std::string::npos && out.size() < maxElements - 1) { | |
| out.push_back(s.substr(start, end - start)); | |
| start = end + delim.length(); | |
| end = s.find(delim, start); | |
| } | |
| out.push_back(s.substr(start, s.length() - start)); |
This file contains hidden or 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
| static std::vector<char> readAllBytes(char const* filename) | |
| { | |
| std::ifstream ifs(filename, std::ios::binary | std::ios::ate); | |
| std::ifstream::pos_type pos = ifs.tellg(); | |
| if (pos == 0) | |
| { | |
| return std::vector<char>{}; | |
| } |
This file contains hidden or 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
| @Test | |
| fun sleepParkNanos() { | |
| val nsec = 960 * 1000_000_000L / 48000 | |
| val looping = AtomicBoolean(true) | |
| val histo = IntArray(10) | |
| val t = Thread() { | |
| val startTime = System.nanoTime() | |
| var i = 0 | |
| while (looping.get()) { |
This file contains hidden or 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
| import numpy as np | |
| import cv2 as cv | |
| import glob | |
| path_to_images = './dji-mini2/*.JPG' | |
| draw_ui = False | |
| def calibrate(): | |
| # termination criteria |
This file contains hidden or 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
| import kotlin.math.* | |
| interface ILatLng { | |
| val lat: Double | |
| val lon: Double | |
| } | |
| enum class Unit(s: String) { | |
| KILOMETERS("km"), | |
| METERS("m"), |
NewerOlder