Skip to content

Instantly share code, notes, and snippets.

View palcu's full-sized avatar
🚒
Responding to a pager alert

Alex Palcuie palcu

🚒
Responding to a pager alert
View GitHub Profile
@palcu
palcu / script.php
Created April 27, 2017 13:37
legislatie.just.ro PHP script
<?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(
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]>
@palcu
palcu / ckan.conf
Created June 2, 2016 13:12
data.gov.ro nginx config
# 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 {
@palcu
palcu / CkanClient.java
Last active August 29, 2016 19:46
CKAN Java create/update a resource
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;
@palcu
palcu / main.cpp
Created April 10, 2016 22:58
Advice C++ InfoClock
// 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
@palcu
palcu / script.py
Created March 16, 2016 13:04
Mapper for Disqus
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])
"use strict";
import $ from "jquery";
export default function(options, accessToken=null) {
let headers = {};
if (accessToken) {
headers = {
<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");
},
@palcu
palcu / ada.js
Last active August 29, 2015 14:22
ada
var form_data = new FormData($('#upload-file')[0]);
$.ajax({
type: 'POST',
url: '/search_trends',
data: form_data,
success: multiwordsSuccess,
contentType: false,
processData: false,
})
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