Skip to content

Instantly share code, notes, and snippets.

Avatar

Hung whatvn

View GitHub Profile
View EC2vsGCP.csv
We can make this file beautiful and searchable if this error is corrected: It looks like row 2 should actually have 3 columns, instead of 1. in line 1.
1 ECU = 1GCU, GCP fixs 2.75 GCU/CPU, EC2 provides ECU as dynamic range based on instance type. This compares EC2 vs GCP based on number of ECU & GCU
Gamma Current Usage GCP Amazon EC2 GCP Price EC2 Price
CPU GCU Ram CPU ECU Ram
(1)C3.Large 4 11 4 2 8 4 94.48 96.63
(3) c3.2xlarge 12 33 15 8 28 15 302.2 387.23
(4) c3.xlarge 6 16.5 7.5 4 14 7.5 151.1 193.98
(1)C4.Large 4 11 4 2 8 3.75 94.48 105.41
@whatvn
whatvn / theoyeucau.py
Last active Jul 6, 2016
download all radio espisode from theoyeucau.com in one shot
View theoyeucau.py
# -*- coding: utf-8 -*-
import re
from collections import OrderedDict
import os
import urllib2
ESPISODE_LINK="http://www.theoyeucau.com/episode"
ESPISODE_LINK_REGEX = re.compile("http\:\/\/www\.theoyeucau\.com\/episode\/[a-zA-Z-]+\/")
View callback.js
updateShipper(id, goods, function (shippers) {
if (shippers.length) {
response = send(shippers, options, callback);
} else {
response = deny(options, callback);
}
});
Muốn lấy cái giá trị response trả về
@whatvn
whatvn / 1smallestin1bil.py
Last active May 12, 2016
find 1 mil smallest number in 1 bil input number
View 1smallestin1bil.py
# origin question&answer
# http://www.vithon.org/2015/04/30/ph%E1%BB%8Fng-v%E1%BA%A5n:-tim-1-tri%E1%BB%87u-s%E1%BB%91-nh%E1%BB%8F-nh%E1%BA%A5t-trong-1-t%E1%BB%B7-s%E1%BB%91
# the origin version use heapq
# this version do not use external module, but use sorted cheat when iterate through set (is not sorted)
def solve(inp, n=1000000):
print inp
heap = set()
for i in inp:
i = -i
View gist:2c2795f48db8dbb4c587
MediaPlayer.dependencies.FragmentLoader = function () {
"use strict";
var RETRY_ATTEMPTS = MediaPlayer.dependencies.FragmentLoader.RETRY_ATTEMPTS,
RETRY_INTERVAL = MediaPlayer.dependencies.FragmentLoader.RETRY_INTERVAL,
xhrs = [],
doLoad = function (request, remainingAttempts) {
View media internal
00:00:00 687 debug Skipping splice frame generation: first new buffer at 1292933us begins at or before existing buffer at 1292933us.
00:00:00 687 debug Skipping splice frame generation: first new buffer at 6721733us begins at or before existing buffer at 6721733us.
00:00:01 292 debug Skipping splice frame generation: first new buffer at 1292933us begins at or before existing buffer at 1292933us.
00:00:01 293 debug Skipping splice frame generation: first new buffer at 6721733us begins at or before existing buffer at 6721733us.
00:00:01 904 debug Skipping splice frame generation: first new buffer at 1292933us begins at or before existing buffer at 1292933us.
00:00:01 905 debug Skipping splice frame generation: first new buffer at 6721733us begins at or before existing buffer at 6721733us.
00:00:02 517 debug Skipping splice frame generation: first new buffer at 1292933us begins at or before existing buffer at 1292933us.
00:00:02 517 debug Skipping splice frame generation: first new buffer at 6721733us begins at
View loop log
[log] > manifest loaded,3 level(s) found, first bitrate:1560000
logger.js:37 [log] > demuxing in webworker
logger.js:37 [log] > switching to level 0
logger.js:37 [log] > (re)loading playlist for level 0
logger.js:37 [log] > media source opened
logger.js:37 [log] > demuxing in webworker
logger.js:37 [log] > switching to level 0
logger.js:37 [log] > (re)loading playlist for level 0
logger.js:37 [log] > media source closed
logger.js:37 [log] > level 0 loaded [0,121],duration:675.0599999999989
View error hls.js
GET http://localhost:8001/ net::ERR_CONNECTION_REFUSED
GET http://dailymotion.github.io/streams.js
[log] > loadSource:http://www.streambox.fr/playlists/x36xhzz/x36xhzz.m3u8
[log] > attachMedia
[log] > media source opened
[log] > manifest loaded,5 level(s) found, first bitrate:2149280
[log] > demuxing in webworker
[log] > switching to level 3
[log] > (re)loading playlist for level 3
[log] > level 3 loaded [0,63],duration:634.584
View gist:d7fcd43c3b025ab338c7
package vn.ethicconsultant.commons.memcachedpool2.Test;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
import net.spy.memcached.MemcachedClient;
import net.spy.memcached.compat.log.Logger;
import net.spy.memcached.compat.log.LoggerFactory;
import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
import vn.ethicconsultant.commons.memcachedpool2.MemcachedPool;
@whatvn
whatvn / 0. nginx_setup.sh
Last active Aug 29, 2015 — forked from mikhailov/0. nginx_setup.sh
Nginx + secure pseudo-streaming
View 0. nginx_setup.sh
# Nginx can serve FLV/MP4 files by pseudo-streaming way without any specific media-server software.
# To do the custom build we use 2 modules: --with-http_secure_link_module --with-http_flv_module
# This module "secure-link" helps you to protect links from stealing away.
#
# NOTE: see more details at coderwall: http://coderwall.com/p/3hksyg
cd /usr/src
wget http://nginx.org/download/nginx-1.5.13.tar.gz
tar xzvf ./nginx-1.5.13.tar.gz && rm -f ./nginx-1.5.13.tar.gz