Skip to content

Instantly share code, notes, and snippets.

@dphov
dphov / ioslocaleidentifiers.csv
Last active May 9, 2018 09:01 — forked from jacobbubu/ioslocaleidentifiers.csv
iOS Locale Identifiers
Locale Identifier Locale Name
mr Marathi
bs Bosnian
ee_TG Ewe (Togo)
ms Malay
kam_KE Kamba (Kenya)
mt Maltese
ha Hausa
es_HN Spanish (Honduras)
ml_IN Malayalam (India)
@dphov
dphov / is_installed.sh
Created November 30, 2017 06:38 — forked from JamieMason/is_installed.sh
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@dphov
dphov / external.htm
Created October 11, 2017 08:55 — forked from bennadel/external.htm
Exploring Recursive Promises In JavaScript
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title>
Exploring Recursive Promises In JavaScript
</title>
</head>
<body>
@dphov
dphov / tmux_build_from_source_CentOS.sh
Last active September 28, 2017 15:14 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
# Steps to build and install tmux from source.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.5
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xzf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
@dphov
dphov / dash-avc264 command lines
Created September 22, 2017 09:15 — forked from ddennedy/dash-avc264 command lines
Use ffmpeg and mp4box to prepare DASH-AVC/264 v1.0 VoD
See my DASH-IF presentation from October, 2014:
https://s3.amazonaws.com/misc.meltymedia/dash-if-reveal/index.html#/
1. encode multiple bitrates with keyframe alignment:
ffmpeg -i ~/Movies/5D2_Portrait.MOV -s 1280x720 -c:v libx264 -b:v 1450k -bf 2 \
-g 90 -sc_threshold 0 -c:a aac -strict experimental -b:a 96k -ar 32000 out.mp4
My input was 30 fps = 3000 ms. If it were 29.97, then a GOP size of 90 frames will yield a base segment
size of 3003 milliseconds. You can make the segment size some multiple of this, e.g.: 6006, 9009, 12012.
@dphov
dphov / ffmpeg_ffprobe.sh
Created July 27, 2017 04:32 — forked from rbrooks/ffmpeg_ffprobe.sh
FFmpeg & FFprobe Cheatsheet
# Don't use FFmpeg for metadata extraction. Use FFprobe.
# Its output is geared toward parsabilty.
# Container and stream information in JSON format:
ffprobe -show_format -print_format json 'Serenity - HD Trailer.mp4'
ffprobe -show_streams -print_format json 'Serenity - HD Trailer.mp4'
# Human-readable values:
ffprobe -show_format -pretty -print_format json 'Serenity - HD Trailer.mp4'
# Trim video to first 30 seconds, without transcoding.
@dphov
dphov / gist:dc6b7257d55732615f0e91c31f4d7f43
Created July 25, 2017 10:18 — forked from wacko/gist:5577187
SSH between Mac OS X host and Virtual Box guest

On Mac OS (host):

Shutdown your VM and do:

VirtualBox > Settings > Network > Add (you will get vboxnet0)

On a terminal ifconfig will show you new interface vboxnet0

VM's Settings > System > check "Enable I/O APIC." VM's Settings > Network > Adapter 2 > host-only vboxnet0

@dphov
dphov / deployUser.md
Created April 5, 2017 05:51 — forked from learncodeacademy/deployUser.md
Adding a deploy user in Linux

(wherever it says url.com, use your server's domain or IP)

Login to new server as root, then add a deploy user

sudo useradd --create-home -s /bin/bash deploy
sudo adduser deploy sudo
sudo passwd deploy

And Update the new password

@dphov
dphov / gist.js
Created December 13, 2016 16:56 — forked from isaacs/gist.js
var args = process.argv.slice(2)
var path = require('path')
var fs = require('fs')
var private = false
var description = ''
var opener = require('opener')
var copy = process.platform === 'darwin'
var open = false
var help = false
var stdin = true