Skip to content

Instantly share code, notes, and snippets.

View lidio601's full-sized avatar

Fabio Cigliano lidio601

View GitHub Profile
@lidio601
lidio601 / openssl_cmd.sh
Last active August 29, 2015 14:02
Openssl Apache Self Signed SSL Certificate
SERVER="webserver.dns.domain.name"
# setup the working directory
mkdir -vp ./public
mkdir -vp ./private
# #########
# custom CA
# #########
@lidio601
lidio601 / send_email.py
Last active August 29, 2015 14:02
Python Send an email throught an SMTP server. In this script i was looking for a filename as a first argument to attach it in the email body
import sys
import time
import os
import smtplib
frm = 'SENDER-EMAIL@ADDRESS'
to = 'DESTINATION-EMAIL@ADDRESS'
smtphost = "YOUR.SMTP.RELAY.HOST"
date = time.ctime(time.time())
@lidio601
lidio601 / http_language.php
Last active August 29, 2015 14:02
PHP get HTTP headers about language support
<?php
echo "<b>Header Accept:</b> " .$_SERVER["HTTP_ACCEPT"]. "<br />\n";
echo "<b>Header Accept-Language:</b> " .$_SERVER["HTTP_ACCEPT_LANGUAGE"]. "<br />\n";
echo "<b>Header Accept-Charset:</b> " .$_SERVER["HTTP_ACCEPT_CHARSET"]. "<br />\n";
echo "<b>Header Accept-Encoding:</b> " .$_SERVER["HTTP_ACCEPT_ENCODING"]. "<br />\n";
?>
@lidio601
lidio601 / json-rpc_test.php
Last active August 29, 2015 14:02
PHP JSON-RPC test file. I was testing a PHP powered web service to manipulate (insert, update, delete) object contained in a table by using a JSON protocol
<?php
// http://en.wikipedia.org/wiki/JSON-RPC
// https://bitbucket.org/jbg/php-json-rpc/overview
// http://qooxdoo.org/downloads
// see https://bitbucket.org/lidio601/framework-fabio
require_once('framework_fabio.php');
ini_set('always_populate_raw_post_data',1);
@lidio601
lidio601 / stack.py
Last active August 29, 2015 14:02
Python stack test
# simulazione di uno stack + stackpointer
grandezza_stack = 100
sp = grandezza_stack
stack = []
def push(valore):
global grandezza_stack,sp,stack
if sp >= 0:
#c'è ancora stackpazio nello stack
@lidio601
lidio601 / accordi.cpp
Last active August 29, 2015 14:02
Converti Accordi dalla notazione inglese a quella italiana
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include <string.h>
struct accordo{
char ing;
char ita[4];
};
#include <stdio.h>
#include <time.h>
#include <iostream.h>
#include <conio.h>
int main(void)
{
int g,h,m;
char a;
#include <conio.h>
#include <iostream.h>
float banco(float);
int i=0;
const int banconote[]={500,200,100,50,20,10,5,2,1};
void main()
{
#include <iostream.h>
#include <stdlib.h>
int main() {
float num;
float conta;
int ris;
conta=1;
num=0;
#include <iostream.h>
#include <conio.h>
#include <dos.h>
#include <stdlib.h>
void main(int arg)
{
clrscr();
randomize();
int cas;