Skip to content

Instantly share code, notes, and snippets.

View dmk1111's full-sized avatar
🐢
Working

Dmytro Holysh dmk1111

🐢
Working
View GitHub Profile
  1. Install ffmpeg:
brew install ffmpeg --with-vpx --with-vorbis --with-libvorbis --with-vpx --with-vorbis --with-theora --with-libogg --with-libvorbis --with-gpl --with-version3 --with-nonfree --with-postproc --with-libaacplus --with-libass --with-libcelt --with-libfaac --with-libfdk-aac --with-libfreetype --with-libmp3lame --with-libopencore-amrnb --with-libopencore-amrwb --with-libopenjpeg --with-openssl --with-libopus --with-libschroedinger --with-libspeex --with-libtheora --with-libvo-aacenc --with-libvorbis --with-libvpx --with-libx264 --with-libxvid

(code above is outdated, foolow instructions at https://gist.github.com/dmk1111/a92a2e8ec4187d921e5c4bb6d5cee7ee)

  1. Convert:
ffmpeg -i input-file.mp4 -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output-file.webm
@dmk1111
dmk1111 / FFMPEG compilation.MD
Last active March 4, 2022 08:12
Install ffmpeg with all options on (Mac OS)

Originally taken from https://gist.github.com/Piasy/b5dfd5c048eb69d1b91719988c0325d8?permalink_comment_id=3314991#gistcomment-3314991

Only way I managed to install it was to compile it myself. Any other way I would only keep getting a recursive dependency error, with ChromaPrint requiring FFmpeg and FFmpeg requiring ChromaPrint.

# start clean. make sure you have xcode installed and all the other basics such as brew.
brew uninstall --force ffmpeg chromaprint amiaopensource/amiaos/decklinksdk

# installs ffmpeg vanilla as dependency
brew install chromaprint amiaopensource/amiaos/decklinksdk

Problem

I have two Github accounts: oanhnn (personal) and superman (for work). I want to use both accounts on same computer (without typing password everytime, when doing git push or pull).

Solution

Use ssh keys and define host aliases in ssh config file (each alias for an account).

How to?

  1. Generate ssh key pairs for accounts and add them to GitHub accounts.
@dmk1111
dmk1111 / native_js_drag_and_drop_helper.js
Created December 1, 2020 15:17 — forked from druska/native_js_drag_and_drop_helper.js
Create the `simulateDragDrop` function which can be used to simulate clicking and dragging one DOM Node onto another
function simulateDragDrop(sourceNode, destinationNode) {
var EVENT_TYPES = {
DRAG_END: 'dragend',
DRAG_START: 'dragstart',
DROP: 'drop'
}
function createCustomEvent(type) {
var event = new CustomEvent("CustomEvent")
event.initCustomEvent(type, true, true, null)
import { AutofillMonitor } from '@angular/cdk/text-field';
import { Directive, ElementRef, Optional, Self } from '@angular/core';
import {
AbstractControl,
DefaultValueAccessor,
RequiredValidator,
Validators,
} from '@angular/forms';
/**
{
"data": [
{
"id": 447365,
"title": "Guardians of the Galaxy Vol. 3",
"tagline": "",
"vote_average": 0,
"vote_count": 9,
"release_date": "2020-05-01",
"poster_path": "https://image.tmdb.org/t/p/w500/ldoY4fTZkGISMidNw60GHoNdgP8.jpg",
@dmk1111
dmk1111 / ng6-templates.md
Created September 17, 2018 10:00
Example of using Angular 2+ (Angular 6) templates with Material Dialog popup

Our team had interesting case with material dialog. We are working on common components, that are used by other teams and our goal is to simplify the development process. The problem was that the material dialogue does not support transclude (<ng-content>). To solve the problem created a separate DialogContentComponent, that is passed into

    this.dialogRef = this.dialog.open(DialogContentComponent, {disableClose: true})

that is inside of DialogComponent. DialogContentComponent has a template of the dialog, which should be everywhere the same, and in DialogComponent template we have only this:

@dmk1111
dmk1111 / ng6-directives-interceptor.md
Last active September 17, 2018 07:35
Example of using Angular 2+ (Angular 6) directive as input interceptor

Directives can be used as interceptors on the input before the model changes. Here is an example of such a directive:

@Directive({
	selector: '[myValueChangeInterceptor]',
	providers: [NgModel]
})
export class InputInterceptorDirective {
	@Input() public myValueChangeInterceptor: (value: string) => string;
	@Output() public valueInput: EventEmitter<string> = new EventEmitter();
@dmk1111
dmk1111 / postgres-brew.md
Last active June 23, 2018 07:55
Installing Postgres via Brew (OSX) (outdated see top most note)

Outdated note: the process is a lot easier now: after you brew install postgresql you can initialize or stop the daemon with these commands: brew services start postgresql or brew services stop postgresql.

new out put may look like

To have launchd start postgresql now and restart at login:
  brew services start postgresql
Or, if you don't want/need a background service you can just run:
  pg_ctl -D /usr/local/var/postgres start
@dmk1111
dmk1111 / git-tag-delete-local-and-remote.sh
Created June 20, 2018 11:09 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName