Skip to content

Instantly share code, notes, and snippets.

View luisfredgs's full-sized avatar
🎯
Focusing

Luís Gonçalves luisfredgs

🎯
Focusing
View GitHub Profile
@luisfredgs
luisfredgs / mp4-strem-laravel.php
Created February 12, 2016 18:31
Pseudo Stream of MP4 files on Laravel
<?php
Route::get('mp4-stream/{filename}', function($filename){
$contentType = "video/mp4";
$path = $filename;
$fullsize = filesize($path);
$size = $fullsize;
$stream = fopen($path, "r");
$response_code = 200;
$headers = array("Content-type" => $contentType);
@luisfredgs
luisfredgs / projeto.wsgi
Created January 21, 2016 04:11 — forked from JuniorLima/projeto.wsgi
WSGI Kinghost
import os
import sys
import site
# Calculates the path based on location of WSGI script.
apache_configuration = os.path.realpath(os.path.dirname(__file__))
project = os.path.join(apache_configuration, 'nomedoproto')
sys.path.append(apache_configuration)
sys.path.append(project)
def hack1(n, k):
def f(s):
return s.count('1')
binaries = []
for x in range(2**n):
binaries.append(bin(x))
binaries.sort(key=f, reverse = True)
return binaries[k - 1]
def hack(n, k):