Skip to content

Instantly share code, notes, and snippets.

View ozthekoder's full-sized avatar

osman ozdemir ozthekoder

View GitHub Profile
@ozthekoder
ozthekoder / chromecast.js
Created March 25, 2018 02:44 — forked from ilyesgouta/chromecast.js
A node.js snippet to stream media files to a Chromecast device
// A node.js snippet to stream media files to a Chromecast device.
// An ac3 or dts audio stream in matroska containers is transcoded to mp3
// using ffmeg. Seeking using left and right keys won't be available.
var Client = require('castv2-client').Client;
var DefaultMediaReceiver = require('castv2-client').DefaultMediaReceiver;
var mdns = require('mdns');
@ozthekoder
ozthekoder / dash-avc264 command lines
Created February 10, 2018 08:22 — 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.
VIDEO_FILE_EXTENSIONS = ['.264',
'.3g2',
'.3gp',
'.3gp2',
'.3gpp',
'.3gpp2',
'.3mm',
'.3p2',
'.60d',
'.787',
@ozthekoder
ozthekoder / color-conversion-algorithms.js
Created September 30, 2017 16:51 — forked from mjackson/color-conversion-algorithms.js
RGB, HSV, and HSL color conversion algorithms in JavaScript
/**
* Converts an RGB color value to HSL. Conversion formula
* adapted from http://en.wikipedia.org/wiki/HSL_color_space.
* Assumes r, g, and b are contained in the set [0, 255] and
* returns h, s, and l in the set [0, 1].
*
* @param Number r The red color value
* @param Number g The green color value
* @param Number b The blue color value
* @return Array The HSL representation
@ozthekoder
ozthekoder / The Technical Interview Cheat Sheet.md
Created January 23, 2016 14:01 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
" general
m = mark position (eg ma then 'a will go back to that position)
cW/cw = change word
cB/cb = change till begining of word
C = change till end of line (delete from curser to end and go into insert mode)
A = insert at end of line
dd = del line
D = delete till end of line
I = go into insert mode at begining of line (before first non-whitespace chars)
L = goto bottom of screen
  1. You have Ghostscript installed, right? Otherwise sudo apt-get install ghostscript
  2. This is important and installs the headers (iapi.h etc) which are required but don't come with the default Ghostscript package: sudo apt-get install libgs-dev
  3. I also needed sudo apt-get install gs-esp
  4. For me the pre compiled version of ImageMagick never accepted Ghostscript, so let's remove it: sudo apt-get --purge remove imagemagick
  5. Get the source of ImageMagick, untar it, cd ImageMagick-xx
  6. ./configure --with-gslib=yes [and what else you need]
  7. Confirm in the output near the bottom gslib yes yes and not gslib yes no
  8. make
  9. make install
  10. Run convert -list configure | grep DELEGATES => DELEGATES bzlib djvu freetype gs jpeg jng jp2 lcms png tiff x11 xml zlib
//
// Regular Expression for URL validation
//
// Author: Diego Perini
// Updated: 2010/12/05
// License: MIT
//
// Copyright (c) 2010-2013 Diego Perini (http://www.iport.it)
//
// Permission is hereby granted, free of charge, to any person