Skip to content

Instantly share code, notes, and snippets.

View VadimBrodsky's full-sized avatar

Vadim Brodsky VadimBrodsky

View GitHub Profile
@VadimBrodsky
VadimBrodsky / keybindings.json
Last active October 26, 2021 16:20
vscode settings
// Place your key bindings in this file to override the defaults
[
{
"key": "ctrl+h",
"command": "workbench.action.focusLeftGroup"
},
{
"key": "ctrl+j",
"command": "workbench.action.focusAboveGroup"
},
@VadimBrodsky
VadimBrodsky / files.txt
Last active January 21, 2021 03:56
ffmpeg concat
# ffmpeg -f concat -safe 0 -i files.txt -codec copy output.mov
# ffmpeg -safe 0 -f concat -segment_time_metadata 1 -i file.txt -vf select=concatdec_select -af aselect=concatdec_select,aresample=async=1 out.mp4
# ffmpeg -i "concat:source-1-int.ts|source-2-int.ts|source-3-int.ts" -c copy output.ts
# ffmpeg -f concat -safe 0 -i files.txt -c copy -bsf:v h264_mp4toannexb -f mpegts output-transcode.ts
# https://stackoverflow.com/questions/15908328/ffmpeg-to-combine-two-mov-files-from-iphone
# ffmpeg -i input1.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate1.ts
# ffmpeg -i input2.mp4 -c copy -bsf:v h264_mp4toannexb -f mpegts intermediate2.ts
# ffmpeg -i "concat:intermediate1.ts|intermediate2.ts" -c copy -bsf:a aac_adtstoasc output.mp4
@VadimBrodsky
VadimBrodsky / VidyardEmbed.tsx
Created November 17, 2020 23:32
Example of a React component wrapping the Vidyard Embed V4 API
import * as React from 'react';
import * as vidyardEmbed from '@vidyard/embed-code';
import ErrorBoundary from './error-boundary';
type VidyardPlayer = typeof vidyardEmbed['players'][0];
export interface Props {
api?: (player: VidyardPlayer, api: typeof vidyardEmbed.api) => unknown;
aspect?: 'portrait' | 'landscape' | number;
maxHeight?: string;
@VadimBrodsky
VadimBrodsky / new-server.sh
Created October 11, 2020 00:26
docker server
# Add user
# https://www.digitalocean.com/community/tutorials/how-to-create-a-new-sudo-enabled-user-on-ubuntu-20-04-quickstart
adduser vadim
usermod -aG sudo vadim
# Copy over the keys
# https://askubuntu.com/questions/1218023/copying-ssh-key-from-root-to-another-user-on-same-machine
sudo cp /root/.ssh/authorized_keys /home/$USER/.ssh/authorized_keys
sudo chown -R $USER:$USER /home/$USER/.ssh
sudo chmod 600 /home/$USER/.ssh/authorized_keys
@VadimBrodsky
VadimBrodsky / config
Created August 8, 2020 14:10
.ssh/config
# https://serverfault.com/a/215027
Host database
HostName <real IP address or hostname here>
User username
@VadimBrodsky
VadimBrodsky / App.js
Created August 7, 2020 02:40
RecordRTC React Example
import React, { useState, useRef, useEffect } from 'react';
import './App.css';
import RecordRTC, { invokeSaveAsDialog } from 'recordrtc';
function App() {
const [stream, setStream] = useState(null);
const [blob, setBlob] = useState(null);
const refVideo = useRef(null);
const recorderRef = useRef(null);
window.onerror("TestRollbarError: testing window.onerror", window.location.href)
@VadimBrodsky
VadimBrodsky / command.sh
Last active November 10, 2019 01:28
Pad Zeroes to File Name
# https://unix.stackexchange.com/questions/346917/rename-files-to-add-leading-zeros-to-numbers
rename -e 's/\d+/sprintf("%02d",$&)/e' -- *.jpg
const hasChange = (prevState: RootState, newState: RootState): ((prop: string) => boolean) => (
propertyPath: string,
): boolean => {
const path = propertyPath.split('.');
try {
const oldProp = path.reduce((prop): unknown => prevState[prop], prevState);
const newProp = path.reduce((prop): unknown => newState[prop], prevState);
return oldProp === newProp;
} catch (e) {
return false;
@VadimBrodsky
VadimBrodsky / flexbox-form.html
Last active February 23, 2019 04:12
What The Flexbox
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<title>Flexbox Single Line Form</title>
<style type="text/css" media="screen">
html {
box-sizing: border-box;
}