Skip to content

Instantly share code, notes, and snippets.

View zimonitrome's full-sized avatar
🧠
backpropagating

zimonitrome

🧠
backpropagating
View GitHub Profile
@zimonitrome
zimonitrome / AEBounceTextTimeControlled.js
Last active October 17, 2023 16:40
After Effects text expression selector for bouncy text where you can control how many characters are shown at a given time.
var sliderProperty = effect("Slider Control")("Slider");
var myDelay = 0; // Default delay
var isCharacterShown = false;
// Loop through each keyframe to find when slider value crosses the textIndex
for (var i = 1; i < sliderProperty.numKeys; i++) {
var keyValueBefore = sliderProperty.key(i).value;
var keyValueAfter = sliderProperty.key(i+1).value;
if (keyValueBefore < textIndex && keyValueAfter >= textIndex) {
@zimonitrome
zimonitrome / Youtube recommendations.md
Last active November 15, 2023 20:07
Youtube channels I watch frequently and recommend.
@zimonitrome
zimonitrome / twitter_scroll_scrape.py
Created February 28, 2023 00:13
Scrape Twitter user tweets by chrome scrolling. Can bypass Twitter API limit and works for protected accounts you have access to.
import time
from selenium import webdriver
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
MAX_STOPS = 5
user = "zimonitrome"
BROWSER = webdriver.Chrome()
@zimonitrome
zimonitrome / warmup_and_decay.py
Last active August 26, 2021 18:36
Python generators that ramps up and ramps down for ML schedules (or other applications).
"""
top_y → | o_
| / \_
| / \_
low_y → |o o
+--------------
↑ ↑
mid last
if mid == 0: only warmup
@zimonitrome
zimonitrome / ffmpeg_combine_frames.ps1
Created July 18, 2020 18:49
Combine frames from render
ffmpeg -r 60 -i {{{FOLDER/FILE}}}_%05d.png -i {{{MUSIC_PATH}}} -c:v libx264 -c:a aac -b:a 1536k -shortest -loglevel error -stats {{{OUTPUT.FILE}}}
@zimonitrome
zimonitrome / start_AE_render.ps1
Created July 18, 2020 16:36
Multi-core render for After Effects.
Start-Process '{{{AE_PATH}}}\Support Files\aerender.exe'-ArgumentList '-project', '"{{{PROJECT_PATH}}}.aep"'
@zimonitrome
zimonitrome / AE_integral.js
Created July 18, 2020 15:50
After Effects integral expression
accum = 0;
for (i = 0; i <= timeToFrames(); i++){
accum += {{{PROPERTY}}}.valueAtTime(framesToTime(i))*thisComp.frameDuration;
}
accum
@zimonitrome
zimonitrome / Open next file.jsx
Last active February 7, 2021 09:00
Photoshop script to open next numbered file in sequence with saving.
var folderPath = activeDocument.path
var filePieces = activeDocument.name.split('.');
var fileName = filePieces[0];
var fileExtension = filePieces[1];
// We need to unpad the string for some reason, otherwise PS-JS
// thinks it's a past layer some times when using parseInt.
fileNameStart = 0;
for (var i = 0; i < fileName.length - 1; i++) {
digit = fileName[i];
if (digit == '0') {
@zimonitrome
zimonitrome / SQL_DB_restart.sql
Last active July 9, 2020 17:30
Used to purge a database. ERASE IT ALL.
USE databaseName
/* ====== DROP ALL RELATIONS ====== */
DECLARE @SQL VARCHAR(MAX)=''
SELECT @SQL = @SQL + 'ALTER TABLE ' + QUOTENAME(FK.TABLE_SCHEMA) + '.' + QUOTENAME(FK.TABLE_NAME) + ' DROP CONSTRAINT [' + RTRIM(C.CONSTRAINT_NAME) +'];' + CHAR(13)
--SELECT K_Table = FK.TABLE_NAME, FK_Column = CU.COLUMN_NAME, PK_Table = PK.TABLE_NAME, PK_Column = PT.COLUMN_NAME, Constraint_Name = C.CONSTRAINT_NAME
FROM INFORMATION_SCHEMA.REFERENTIAL_CONSTRAINTS C
INNER JOIN INFORMATION_SCHEMA.TABLE_CONSTRAINTS FK
ON C.CONSTRAINT_NAME = FK.CONSTRAINT_NAME