Skip to content

Instantly share code, notes, and snippets.

@muffl0n
muffl0n / curl.py
Last active January 28, 2016 07:43
PyCurl: 'GnuTLS recv error (-9): A TLS packet with unexpected length was received.'
from __future__ import print_function
import pycurl
print(pycurl.version)
c = pycurl.Curl()
c.setopt(pycurl.URL, 'https://packages.graylog2.org/repo/debian/dists/trusty/0.92/binary-amd64/Packages')
c.setopt(pycurl.PROXY, 'my_proxy')
-> % http -p Hh http://localhost:8123/ "If-Modified-Since: Thu, 07 Jan 2016 11:42:12 GMT"
GET / HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Host: localhost:8123
If-Modified-Since: Thu, 07 Jan 2016 11:42:12 GMT
User-Agent: HTTPie/0.9.2
HTTP/1.1 200 OK
-> % http --headers http://localhost:8123/ "If-Modified-Since: Thu, 07 Jan 2016 12:10:31 GMT"
HTTP/1.1 200 OK
Connection: keep-alive
Content-Encoding: gzip
Content-Type: text/html
Date: Thu, 07 Jan 2016 12:21:06 GMT
Last-Modified: Thu, 07 Jan 2016 11:42:13 GMT
Server: nginx/1.4.6 (Ubuntu)
Transfer-Encoding: chunked
num = 0.7
print(num)
num += 0.1
print(num)
-->
0.7
0.7999999999999999
@gewinnzahlen = sort(NummernSort @gz);
sub NummernSort {
if($a < $b){
return -1;
} elsif ($a == $b){
return 0;
} else {
return 1;
var args = require('system').args;
var webpage = require('webpage');
var page = webpage.create();
var url = args[1];
page.viewportSize = {
width: 1024,
height: 768
};
page.open(url, function () {
console.log(page.renderBase64('PNG'));
sub GetDate
{
@Months = ('01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12');
@Now = localtime(time());
$Month = $Months[$Now[4]];
$Year = $Now[5]+1900;
$todaydate = localtime(time());
@day = split(/ +/,$todaydate);
@time = split(/:/,$day[3]);
return "$Year$Month$Now[3]_$time[0]$time[1]$time[2]";
@muffl0n
muffl0n / vhost_test_file.conf
Last active August 29, 2015 14:21
Apache 2.4 File-/Location-Directive glitch
<VirtualHost *:80>
ServerName test_file
DocumentRoot /tmp/test/htdocs
<Location "/">
Require all granted
</Location>
<Files "test.html">
AuthType Basic
@muffl0n
muffl0n / gist:3c3424aa6ab7d598f604
Last active August 29, 2015 14:20
/etc/environment: ubuntu 12 vs 14
Ubuntu 12:
testuser@ubuntu12:~$ grep http_proxy /etc/environment
http_proxy="http://foo.example.com:8080"
testuser@ubuntu12:~$ sudo su - -c env |grep http_proxy
http_proxy=http://foo.example.com:8080
testuser@ubuntu12:~$ sudo env |grep http_proxy
http_proxy=http://foo.example.com:8080
testuser@ubuntu12:~$ env |grep http_proxy
http_proxy=http://foo.example.com:8080
<?php
$uuid = $_GET['uuid'];
if ($uuid) {
}
?>