Skip to content

Instantly share code, notes, and snippets.

View Londeren's full-sized avatar
💭
Building a rocket 🚀

Sergey Lebedev Londeren

💭
Building a rocket 🚀
View GitHub Profile
@Londeren
Londeren / app.module.ts
Last active August 5, 2022 08:29
Angular 14 custom ViewportScroller for Router option scrollPositionRestoration
// …
@NgModule({
imports: [
AppRouterModule,
// …
],
bootstrap: [RootComponent],
providers: [
// …
@Londeren
Londeren / js-array-practice.js
Last active April 27, 2022 11:37
Javascript array map, reduce practice
// 1. Implement `reduce` via forEach. Expected api for the function:
reduce(arr, (acc, item) => acc + item, 0);
// example of implementation:
function reduce(arr, reducerCallback, initialValue) {
let result;
……forEach(…)
return result;
}
@Londeren
Londeren / ffmpeg commands
Last active April 17, 2022 14:50
ffmpeg useful commands
for filename in *.mp4; do ffmpeg -ss 12 -i "$filename" -c copy out-"$filename";done; # trim first 12 seconds
for filename in *.mp4; do printf "file '%s'\n" "$filename" >> ffmpeg_concat.txt;done;ffmpeg -f concat -i ffmpeg_concat.txt -c copy output-result.mp4; rm ffmpeg_concat.txt # concat ffmpeg
for filename in *.mp4; do ffmpeg -i "$filename" 2>&1 | grep Duration | awk '{print $2}' | tr -d , >> ffmpeg_concat.txt;done; # video duration time
ffmpeg -i video.mp4 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - > out.gif # video to gif
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset medium -c:a copy video-out.mp4 #optimize reduce size
const times = {
'Video 0': '00:39:13',
'Video 1': '00:29:03',
'Video 2': '00:24:02',
'Video 3': '00:31:55',
'Video 4': '00:32:26',
'Video 5': '00:42:29',
'Video 6': '00:49:11',
};
#!/usr/bin/env node
// Raycast Script Command Template
//
// Dependency: This script requires Nodejs.
// Install Node: https://nodejs.org/en/download/
//
// Duplicate this file and remove ".template" from the filename to get started.
// See full documentation here: https://github.com/raycast/script-commands
//
@Londeren
Londeren / antonyms.txt
Last active December 8, 2021 17:31
Synonyms/antonyms for functions and variables
bind → unbind
on → off
link → unlink
attach → detach
add → remove delete
start → stop finish
begin → end
init → destroy
set → unset
delegate → undelegate
function IS_PASSED(arRange, currentDay, immunityCount) {
const IMMUNITY_SCORE = 1;
const NO_REPORT_SCORE = 0;
const range = arRange[0];
var immunities = immunityCount;
for (var day = 0; day < currentDay; day++) {
var score = Number(range[day]);
@Londeren
Londeren / bounce.jsx
Last active September 27, 2019 05:19
After effects bounce timur-ko.livejournal.com/38980.html
amp = .1; //Чем больше значение, тем больше амблитуда
freq = 5; //Чем больше значение, тем больше частота
decay = 7; //Чем больше значение, тем меньше задержка
n = 0;if (numKeys > 0){n = nearestKey(time).index;if (key(n).time > time){n--;}}if (n == 0){t = 0;}else{t = time - key(n).time;} if (n > 0){v = velocityAtTime(key(n).time - thisComp.frameDuration/10);value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);}else{value;}