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
""" | |
This program plots output of top commands dumped in different files | |
""" | |
import sys | |
import numpy | |
from matplotlib import pyplot | |
def clean(line): |
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 os | |
import requests | |
link = 'http://api.wordnik.com/v4/words.json/randomWords?hasDictionaryDef=tru' | |
'e&minCorpusCount=0&minLength=5&maxLength=15&limit=1&api_key=' | |
+ os.environ.get('WORDNIK_KEY') | |
loklak_host = 'http://35.188.118.126' | |
while True: |
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
""" | |
Kaizen Harvester - https://github.com/loklak/loklak_server/blob/development/src/org/loklak/harvester/strategy/KaizenHarvester.java | |
loklak server project - https://github.com/loklak/loklak_server | |
""" | |
import random | |
from matplotlib import pyplot | |
m = [] |
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) |
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 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 |
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
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
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 |
OlderNewer