I [2017-09-09 14:53:35,843][WARN ][cluster.action.shard ] [Controller] [messages_week][4] received shard failed for [messages_week][4], node[3cz-CBk5Ro-0MCy0A9cp6A], [P], v[137], s[INITIALIZING], a[id=2gM_hcRETP2Eg2vsAjJkyQ], unassigned_info[[reason=ALLOCATION_FAILED], at[2017-09-09T14:52:56.492Z], details[failed recovery, failure IndexShardRecoveryException[failed to recovery from gateway]; nested: EngineCreationFailureException[failed to recover from translog]; nested: EngineException[failed to recover from translog]; nested: TranslogCorruptedException[translog corruption while reading from stream]; nested: TranslogCorruptedException[translog stream is corrupted, expected: 0x64332db9, got: 0x74223a30]; ]], indexUUID [vhW2TG5uTHiYPUwNZRJSiQ], message [failed recovery], failure [IndexShardRecoveryException[failed to recovery from gateway]; nested: EngineCreationFailureException[failed to recover from translog]; nested: EngineException[failed to recover from translog]; nested: TranslogCorruptedExcepti
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import beem | |
from datetime import datetime | |
def get_resource_credits(username): | |
client = beem.Steem() | |
rc = beem.rc.RC(steem_instance=client) | |
account = beem.account.Account(username).json() | |
comment_requirement = rc.comment() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const autoprefixer = require('autoprefixer'); | |
const path = require('path'); | |
const webpack = require('webpack'); | |
const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
const CaseSensitivePathsPlugin = require('case-sensitive-paths-webpack-plugin'); | |
const InterpolateHtmlPlugin = require('react-dev-utils/InterpolateHtmlPlugin'); | |
const WatchMissingNodeModulesPlugin = require('react-dev-utils/WatchMissingNodeModulesPlugin'); | |
const eslintFormatter = require('react-dev-utils/eslintFormatter'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_data_from_response(resp, chunk=2048): | |
for data_chunk in resp.iter_content(chunk_size=chunk): | |
yield data_chunk | |
def serve_partial(url, range_header, mime, size=3145728): | |
from_bytes, until_bytes = range_header.replace('bytes=', '').split('-') | |
if not until_bytes: | |
until_bytes = int(from_bytes) + size # Default size is 3MB | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
range_header = request.headers.get('Range', None) | |
if range_header: | |
from_bytes, until_bytes = range_header.replace('bytes=', '').split('-') | |
if not until_bytes: # No until bytes is set, set it to start + 3MB | |
until_bytes = int(from_bytes) + int(1024 * 1024 * 3) # 1MB * 3 = 3MB | |
# Get only what required from YouTube | |
headers = {'Range': 'bytes=%s-%s' % (from_bytes, until_bytes)} | |
r = requests.get(url, headers=headers) | |
data = r.content |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
r = requests.get(url) | |
range_header = request.headers.get('Range', None) | |
if range_header: # Client has requested for partial content | |
size = int(r.headers.get('content-length')) # Actual size of song | |
# Look up for ranges | |
m = re.search('(\d+)-(\d*)', range_header) | |
g = m.groups() | |
byte1, byte2 = 0, None | |
if g[0]: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@app.after_request | |
def after_request(response): | |
response.headers.add('Accept-Ranges', 'bytes') | |
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import steem from 'steem'; | |
// Get the form values | |
let username = document.getElementById('steem-username').value; | |
let privatePostingKey = document.getEmenentById('steem-posting-key').value; | |
// Get user details | |
steem.api.getAccounts([username], (err, result) => { | |
if (err) { | |
// Something went wrong |
Student: Pratyush Singh (@singhpratyush)
Organisation: FOSSASIA
Project: Add Endpoints to Loklak API and Implement World Mood Tracker
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy | |
from matplotlib import pyplot | |
from mpl_toolkits.mplot3d import Axes3D | |
from matplotlib import cm | |
x = numpy.arange(0, 30, 0.1) | |
y = numpy.arange(0, 30, 0.1) | |
x, y = numpy.meshgrid(x, y) |
NewerOlder