Skip to content

Instantly share code, notes, and snippets.

View ox's full-sized avatar
👹
what is this, AIM?

Artem Titoulenko ox

👹
what is this, AIM?
View GitHub Profile
@ox
ox / basic.m3u8
Last active October 26, 2017 14:58
HLS Post
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=232370,CODECS="mp4a.40.2, avc1.4d4015"
gear1/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=649879,CODECS="mp4a.40.2, avc1.4d401e"
gear2/prog_index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=991714,CODECS="mp4a.40.2, avc1.4d401e"
@ox
ox / 1-promise-test.js
Last active October 3, 2017 16:36
Test Promise memory usage during recursive promises
const Promise = require('bluebird');
const memwatch = require('memwatch-next');
function async() {
return Promise.resolve();
}
function run(iter=0) {
if (iter >= 10000000) { return Promise.resolve(); }
return async()
@ox
ox / com.artem.kubernetes-proxy.plist
Created September 19, 2017 15:45
launch agent to run kubectl proxy on port 8001 in the background without taking up a terminal. logs go to Console.app.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.artem.kubernetes-proxy</string>
<key>ProgramArguments</key>
<array>
<string>/Users/artem/code/tools/google-cloud-sdk/bin/kubectl</string>
@ox
ox / plan.md
Last active September 1, 2017 20:27
Speeding up Video Playing with HLS

goals:

  • speed up time to first byte

Side goals:

  • improve viewing experience for a variety of devices and networks
    • HLS automatically switches bitrates/resolutions based on bandwidth
  • allow all kinds of clients to play the video reliably
@ox
ox / keymap.cson
Last active May 10, 2017 18:36
Atom keymap for using a Mac keyboard on Ubuntu (any platform, really)
'atom-workspace atom-text-editor:not([mini])':
'cmd-g': 'find-and-replace:find-next'
'cmd-G': 'find-and-replace:find-previous'
'cmd-s': 'core:save'
'cmd-shift-s': 'core:save-as'
'atom-workspace atom-text-editor':
'cmd-down': 'core:move-to-bottom'
'cmd-up': 'core:move-to-top'
@ox
ox / iterator.js
Created January 25, 2017 17:58
Partitioned iterator
const Promise = require('bluebird');
function iterator(entities = [], mapFn, concurrent = 2) {
const partitionSize = entities.length / concurrent;
const partitions = [];
for (let i = 0; i < concurrent; i++) {
const start = i * partitionSize;
const entitiesInPartition = entities.slice(start, start + partitionSize);
partitions.push(Promise.mapSeries(entitiesInPartition, mapFn));
}

Keybase proof

I hereby claim:

  • I am ox on github.
  • I am ofxartem (https://keybase.io/ofxartem) on keybase.
  • I have a public key whose fingerprint is 34AA CAB5 35A1 3FD2 4F6F 8252 25A1 1774 762F 6117

To claim this, I am signing this object:

@ox
ox / column.hs
Last active November 7, 2016 20:59
Formats input separated by tabs into columns
module Main where
import Data.List (transpose, words, lines, unwords, unlines)
import Data.Text (justifyLeft, unpack, pack)
prettyText :: [[String]] -> [[String]]
prettyText inputRows =
let colWidths = map (maximum . map length) (transpose inputRows)
indentFn = map (\x -> unpack . justifyLeft (x+2) ' ' . pack) colWidths -- right-pad each elem by col width + 2
in map (zipWith ($) indentFn) inputRows -- apply each column's padding to each element
@ox
ox / .vimrc
Created April 13, 2015 15:45
Minimal vimrc, need to install pathogen plugins
set nocompatible " be iMproved, required
" use bash as the shell instead of fish
set shell=/bin/bash
" launch pathogen
execute pathogen#infect()
""
"" General Settings
var wordIsFlamingo = function (word) {
var isFlamingo = false;
switch (word) {
case "flamingo":
isFlamingo = true;
break;
default:
isFlamingo = false;
break;