Discover gists
#! /usr/bin/env python3 | |
# birdnet_to_mqtt.py | |
# | |
# 202306171542 | |
# | |
# monitor the records in the syslog file for info from the birdnet system on birds that it detects | |
# publish this data to mqtt | |
# | |
import time |
#!/usr/bin/env bash | |
# Abort sign off on any error | |
set -e | |
# Start the benchmark timer | |
SECONDS=0 | |
# Repository introspection | |
OWNER=$(gh repo view --json owner --jq .owner.login) |
''' | |
Basic tail command implementation | |
Usage: | |
tail.py filename numlines | |
''' | |
import sys | |
import linecache |
To be frank, I don't know all the details about making your own custom Animation class. I know only a general idea, but the details are fuzzy. I usually end up using a trial-and-error approach trying different methods and reading the source code of similar animations, until it works. But the main idea is:
- An animation receives a
mobject
(it can be a group) on which it will operate. In the__init__
method usually it only stores that object intoself.mobject
, so every animation has that object, and other animation attributes such as the run time, rate function, etc. - When used in a
.play()
, manim will call itsbegin()
method. Usually you don't need to override that. The default implementation creates another inner object calledself.starting_mobject
which stores the initial state of the mobject being animated, and it is simply a deep copy ofself.mobject
(although you can override how that starting mobject is created by overriding `create_starting_mobj
# original source: https://gist.github.com/tkarpinski/2369729 | |
require 'octokit' | |
require 'csv' | |
require 'date' | |
# Github access token to access the project | |
# Create one at https://github.com/settings/tokens | |
ACCESS_TOKEN="GITHUB_ACCESS_TOKEN" |
[CmdletBinding()] Param ( | |
[Parameter()][ValidateSet('On', 'Off')][string]$BluetoothStatus | |
) | |
If ((Get-Service bthserv).Status -eq 'Stopped') { Start-Service bthserv } | |
Add-Type -AssemblyName System.Runtime.WindowsRuntime | |
$asTaskGeneric = ([System.WindowsRuntimeSystemExtensions].GetMethods() | ? { $_.Name -eq 'AsTask' -and $_.GetParameters().Count -eq 1 -and $_.GetParameters()[0].ParameterType.Name -eq 'IAsyncOperation`1' })[0] | |
Function Await($WinRtTask, $ResultType) { | |
$asTask = $asTaskGeneric.MakeGenericMethod($ResultType) | |
$netTask = $asTask.Invoke($null, @($WinRtTask)) | |
$netTask.Wait(-1) | Out-Null |
Manim provides out of the box the possibility of marking parts of your scene as separate sections, by using self.next_section()
. This will cause a separate video to be rendered for each section, and then all of them will be stitched together for the final result. The final result will be the same as if you hadn't used sections at all.
But the use of sections allows you to mark some of them with the parameter skip_animations=True
, and in that case, that section will not be rendered. The code of the section will be run anyway (because it may be defining objects or variables needed in following sections), but for every self.play()
, only the final frame will be computed (and not rendered). This ensures that, at the end of the section, all objects are at the same positions as if the animations were played, but skipping the actual rendering significantly reduces the time required to run the code.
In addition, the resulting video when skip_animations=True
is used will be s
# Copyright 2022 Google LLC. | |
# SPDX-License-Identifier: Apache-2.0 | |
# Author: Maithra Raghu <maithra@google.com> | |
def compute_distance_matrix(patch_size, num_patches, length): | |
"""Helper function to compute distance matrix.""" | |
distance_matrix = np.zeros((num_patches, num_patches)) |