Skip to content

Instantly share code, notes, and snippets.

@MasterEx
MasterEx / Main.java
Created December 2, 2010 22:47
A lucene application for my Information Retrieval class.
/**
* A lucene application for my Information Retrieval class.
*/
package luceneir;
import java.io.IOException;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.List;
@MasterEx
MasterEx / zipFiles.php
Created February 20, 2011 13:39
PHP zip file creation
<?php
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <[email protected]> wrote this file. As long as you retain this notice you
* can do whatever you want with this stuff. If we meet some day, and you think
* this stuff is worth it, you can buy me a beer in return Periklis Ntanasis
* ----------------------------------------------------------------------------
*/
@MasterEx
MasterEx / ascii.css
Created February 28, 2011 16:20
bansky art
.ascii {
text-align: center;
color: black;
text-decoration: none;
width:99%;
margin:auto;
}
package lib.transformations;
import java.awt.Graphics;
import java.awt.color.ColorSpace;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.awt.image.ColorConvertOp;
import java.util.ArrayList;
import java.util.List;
@MasterEx
MasterEx / output.rss
Created June 26, 2011 21:21
Shell RSS writer
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>yo</title>
<link>http://www.google.com</link>
<description>hello wold</description>
<language>en-us</language>
<generator>just a shell script rss writer</generator>
<item>
<title>AUEB FOSS COMMUNITY</title>
@MasterEx
MasterEx / conf.php
Created July 20, 2011 20:31
PHP - include global configuration variables to functions and classes
<?php
//way 1
$bla = "tralala";
//way 2
$GLOBALS["blabla"] = "yoohoo";
?>
<?php
$input = "this is my sample which is sorted and simple";
echo "Input: ".$input."<br/>";
foreach(explode(" ",$input) as $in)
{
if(isset($firstarray[strlen($in)][$in]))
$firstarray[strlen($in)][$in]++;
<?php
/**
* Retrieve public ip with PHP cURL
*/
$curl_handle=curl_init();
curl_setopt($curl_handle,CURLOPT_URL,'http://whatismyip.org/');
curl_setopt($curl_handle,CURLOPT_RETURNTRANSFER,1);
curl_setopt($curl_handle,CURLOPT_CONNECTTIMEOUT,2);
$public_ip = curl_exec($curl_handle);
@MasterEx
MasterEx / README.md
Created August 10, 2011 02:04
PHP download file wrapper

In the example the directory that contains the script also contains the directory files.

In order to download a file with filename "file.txt" we should call the script like http://domainname/file.php?filename=file.txt .

If the file doesn't exist we will get a "FILE NOT FOUND" message, otherwise we will get the file.

This is a good practice in order to conceal our file true location.

@MasterEx
MasterEx / README.md
Created August 11, 2011 11:05
ArchLinux broken package entries

Somehow my /var was corrupted and I lost some files from /var/pacman/local/.

The files were many so I decided to download all the descriptions with the following script.

The -f argument does the following:

Bypass file conflict checks and overwrite conflicting files. If the package that is about to be installed contains files that are