Skip to content

Instantly share code, notes, and snippets.

@abul4fia
abul4fia / Animations.md
Created March 11, 2024 08:56
How Animation works (more or less)

How animations work (more or less)

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:

  1. 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 into self.mobject, so every animation has that object, and other animation attributes such as the run time, rate function, etc.
  2. When used in a .play(), manim will call its begin() method. Usually you don't need to override that. The default implementation creates another inner object called self.starting_mobject which stores the initial state of the mobject being animated, and it is simply a deep copy of self.mobject (although you can override how that starting mobject is created by overriding `create_starting_mobj
@rkallensee
rkallensee / github_issues_to_csv.rb
Last active April 30, 2024 11:48 — forked from tkarpinski/github_issues_to_csv.rb
Export Github issues to CSV grouped by Milestone
# 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"
@u01jmg3
u01jmg3 / bluetooth.ps
Created May 17, 2020 09:52
Windows Powershell Script to Toggle Bluetooth On or Off
[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
@abul4fia
abul4fia / 00README.md
Last active April 30, 2024 11:44
Working with sections in manim

Working with sections in manim

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

@simonster
simonster / attention_distance.py
Last active April 30, 2024 11:43
Mean attention distance
# 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))
@veekaybee
veekaybee / normcore-llm.md
Last active April 30, 2024 11:43
Normcore LLM Reads

Anti-hype LLM reading list

Goals: Add links that are reasonable and good explanations of how stuff works. No hype and no vendor content if possible. Practical first-hand accounts of models in prod eagerly sought.

Foundational Concepts

Screenshot 2023-12-18 at 10 40 27 PM

Pre-Transformer Models

Registered Name: https://zhile.io
License Key: 48891cf209c6d32bf4
@gtasnail
gtasnail / pedResetFlags.lua
Created April 11, 2024 22:45
All known ped reset config flags | SetPedResetFlag SET_PED_RESET_FLAG |
PRF_DisablePlayerJumping = 46, -- Disable jumping
PRF_DisablePlayerVaulting = 47, -- Disable climbing / vaulting
PRF_AllowUpdateIfNoCollisionLoaded = 55, -- Don't freeze this ped for not having bounds loaded around it
PRF_DisableSecondaryAnimationTasks = 58, -- Disable upper body animtion tasks such as shove ped and open door anims
PRF_SearchForClosestDoor = 60, -- Will check for the closest door in proximity and store it off
PRF_SupressGunfireEvents = 62, -- Supresses AI generating fire events, so civilians wont be shocked or react, for use in a shooting range for example
PRF_InfiniteStamina = 63, -- Currently just for mounts, but could be expanded to anything with stamina
PRF_BlockWeaponReactionsUnlessDead = 64, -- Stops the ped from reacting to damage events (such as shots / fires, etc). The ped will still take damage while this flag is active. Note: this does not block explosion reactions.
PRF_ForcePlayerFiring = 65, -- Forces player to fire even if they aren't pressing fire
PRF_For
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active April 30, 2024 11:40 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@alfredlucero
alfredlucero / index.d.ts
Last active April 30, 2024 11:40
Cypress Tips/Tricks - Typing Task Plugin Functions
// Can import types from other files using TypeScript's typed imports functionality
type BlocksDto = import("../plugins/Suppressions/setup").BlocksDto;
// Or you can define the types here as well in this type definition file
type ApiHost = "https://staging.api.com" | "https://testing.api.com" | string;
declare namespace Cypress {
interface Cypress {
// ...environment variables
}