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
<?php | |
// First request for the token | |
$client = new SoapClient("http://legislatie.just.ro/apiws/FreeWebService.svc?wsdl"); | |
$response = $client->GetToken(); | |
var_dump($response); | |
// Second request for getting the actual data | |
$params = array( |
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
In [25]: session = requests.Session() | |
In [27]: data = {'username':'palcuiealex', 'password':"bla"} | |
In [28]: url | |
Out[28]: 'https://infoarena.ro/login' | |
In [29]: session.post(url, data=data) | |
Out[29]: <Response [200]> |
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
# BEWARE | |
# There are two parts, first port 80 and then port 443 | |
# We have 2 needs: serving everything that we can on HTTP (this means we redirect most of the requests from HTTPS) | |
# Serving the login page and logged in people from HTTPS | |
proxy_cache_path /tmp/nginx_cache levels=1:2 keys_zone=cache:30m max_size=250m; | |
proxy_temp_path /tmp/nginx_proxy 1 2; | |
server_tokens off; | |
server { |
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 java.io.File; | |
import java.io.IOException; | |
import org.apache.http.HttpEntity; | |
import org.apache.http.HttpResponse; | |
import org.apache.http.client.methods.HttpPost; | |
import org.apache.http.entity.mime.MultipartEntityBuilder; | |
import org.apache.http.impl.client.CloseableHttpClient; | |
import org.apache.http.impl.client.HttpClientBuilder; |
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
// Includes all headers | |
#include <bits/stdc++.h> | |
// Don't be afraid to use constants | |
const int N = 1024; | |
void do_not_use_endl() { | |
vector<int> primes {2, 3, 5, 8, 11}; | |
// Let's tail -f the output file |
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 csv | |
urls = [] | |
with open('links.csv') as stream: | |
for line in stream: | |
url = line.strip() | |
if 'http' in url and 'https' not in url: | |
better_url = url.replace('http', 'https', 1) # replace only first occurence | |
urls.append([url, better_url]) |
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"; | |
import $ from "jquery"; | |
export default function(options, accessToken=null) { | |
let headers = {}; | |
if (accessToken) { | |
headers = { |
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
<html> | |
<head></head> | |
<body> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.js"></script> | |
<script> | |
$(function(){ | |
$.ajaxSetup({ | |
beforeSend: function (request) { | |
request.setRequestHeader("Authorization", "9:2sPtL9PnthjxQJEFDztK"); | |
}, |
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
var form_data = new FormData($('#upload-file')[0]); | |
$.ajax({ | |
type: 'POST', | |
url: '/search_trends', | |
data: form_data, | |
success: multiwordsSuccess, | |
contentType: false, | |
processData: false, | |
}) |
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
Flask==0.10.1 | |
itsdangerous==0.24 | |
Jinja2==2.7.3 | |
langdetect==1.0.5 | |
MarkupSafe==0.23 | |
oauthlib==0.7.2 | |
requests==2.7.0 | |
requests-oauthlib==0.5.0 | |
six==1.9.0 | |
tweepy==3.3.0 |
NewerOlder