This file contains hidden or 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
from flask import Flask | |
app = Flask(__name__) | |
@app.route("/<int:x>-<int:y>") | |
def sum(x,y): | |
return ("Sum of x + y = " + str(x+y)) | |
if __name__ == '__main__': | |
app.debug = True | |
app.run(host="127.0.0.1", port=8800) |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title> test_local </title> | |
</head> | |
<body> | |
<p> Sum of two numbers: </p> | |
<form> | |
Number 1 : <input type="text" name="n1"> | |
number 2 : <input type="text" name="n2"> |
This file contains hidden or 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
function testFunc (form) { | |
var x = form.n1.value; | |
var y = form.n2.value; | |
$.ajax({ | |
type: 'GET', | |
url: "http://127.0.0.1:5000/"+x+"-"+y, | |
contentType: 'text/plain', | |
success: function(response, textStat){ | |
response = "The total sum is" + response; |
This file contains hidden or 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.route("/<int:x>-<int:y>") | |
def sum(x, y): | |
resp = make_response(str(x + y)) | |
resp.headers['Access-Control-Allow-Origin'] = '*' | |
return resp |
This file contains hidden or 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 requests | |
import bs4 as FARHAN | |
black_page = "http://blacklivesmatter.com/who-we-are/" | |
res = requests.get(black_page) | |
res.raise_for_status() | |
black_file = open('/tmp/blacklivesmatter.txt', 'wb') | |
for chunk in res.iter_content(100000): | |
black_file.write(chunk) |
This file contains hidden or 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
from pprint import pprint | |
import jinja2 | |
import markdown | |
HTML_TEMPLATE = """{% macro get_html() %} | |
{{ content | markdown }} | |
{% endmacro %} | |
{% set html_content = get_html() %} | |
Title from Markdown meta-data: {{ get_title() }} |
This file contains hidden or 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
/* To find the smallest positive number | |
* which can not be constructed out of | |
* the given count of numbers [0-9] | |
* | |
* Date: 25th Feb, 2016 | |
*/ | |
#include<stdio.h> | |
#define N 10 | |
#define MAX_COUNT 99999 |
This file contains hidden or 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
// Find this on codepen http://codepen.io/miteshninja/full/gMMrmo/ | |
// Code refactored by @barneycarroll | |
var app = {}; | |
var api = "https://en.wikipedia.org/w/api.php?format=json&action=query&generator=search&gsrnamespace=0&gsrlimit=10&prop=pageimages|extracts&pilimit=max&exintro&explaintext&exsentences=1&exlimit=max&gsrsearch="; | |
var cb = '&callback=JSON_CALLBACK'; | |
var wPage = "https://en.wikipedia.org/?curid="; | |
app.WikiPages = function (title) { | |
return m.request({ |
This file contains hidden or 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
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE en-export SYSTEM "http://xml.evernote.com/pub/evernote-export2.dtd"> | |
<en-export export-date="20120727T073610Z" application="Evernote" version="Evernote Mac 3.0.5 (209942)"> | |
<note><title>Vim Tips</title><content><![CDATA[<?xml version="1.0" encoding="UTF-8" standalone="no"?> | |
<!DOCTYPE en-note SYSTEM "http://xml.evernote.com/pub/enml2.dtd"> | |
<en-note style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"> | |
yank for copy, delete for cut, put for parse | |
<div><br/></div> | |
<div>Move in context, not position</div> | |
<div>/ search forward</div> |
This file contains hidden or 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
my@server1:~$ ab -n 500 -c 50 http://oxal.org/ | |
This is ApacheBench, Version 2.3 <$Revision: 1528965 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking oxal.org (be patient) | |
Completed 100 requests | |
Completed 200 requests | |
Completed 300 requests | |
Completed 400 requests |
OlderNewer