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.IOException; | |
import java.io.ObjectInputStream; | |
import java.io.ObjectOutputStream; | |
import java.net.Socket; | |
/** | |
* Classe client che si interfaccia con EchoServer. Un client | |
* può effettuare una sola richiesta del servizio per connessione. | |
*/ |
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
#!/bin/bash | |
if [ $# -ne 1 ]; then | |
echo "USAGE: $0 [font-file]" | |
exit 1 | |
fi | |
if [ "$(whoami)" != "root" ]; then | |
echo "You do not have enough privileges to use this script" | |
exit 1 |
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.util.HashMap; | |
import java.util.Scanner; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
public class CPU { | |
public String[] ram; | |
private HashMap<String, Instruction> rom; | |
private double accumulator; | |
private int instructionPointer; |
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.util.*; | |
public class Brainfuck { | |
private Scanner sc = new Scanner(System.in); | |
private final int LENGTH = 65535; | |
private byte[] mem = new byte[LENGTH]; | |
private int dataPointer; | |
public void interpret(String code) { | |
int l = 0; | |
for(int i = 0; i < code.length(); i++) { |
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 | |
namespace controller\api; | |
/** | |
* Base Controller class, it provides some helper methods | |
* to his child classes. | |
* | |
* You can make api calls by setting X-Auth-Token header | |
* value. All parameters all passed in x-www-urlencoded |
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 | |
class Event { | |
private $events = []; | |
public function on($event, $callback, $priority = 0) { | |
// check if an event is not already created | |
if (!isset($this->events[$event])) $this->events[$event] = new \SplPriorityQueue(); | |
// make $this available in closures | |
if (is_object($callback) && $callback instanceof \Closure) { |
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.IOException; | |
import java.nio.charset.StandardCharsets; | |
import java.nio.file.Files; | |
import java.nio.file.Paths; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Scanner; | |
import java.util.Stack; | |
/** |
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 | |
function getRealIpAddr() | |
{ | |
if (!emptyempty($_SERVER['HTTP_CLIENT_IP'])) | |
{ | |
$ip=$_SERVER['HTTP_CLIENT_IP']; | |
} | |
elseif (!emptyempty($_SERVER['HTTP_X_FORWARDED_FOR'])) | |
//to check ip is pass from proxy |
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 | |
function getCloud( $data = array(), $minFontSize = 12, $maxFontSize = 30 ) | |
{ | |
$minimumCount = min($data); | |
$maximumCount = max($data); | |
$spread = $maximumCount - $minimumCount; | |
$cloudHTML = ''; | |
$cloudTags = 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
<?php | |
/****************** | |
*@email - Email address to show gravatar for | |
*@size - size of gravatar | |
*@default - URL of default gravatar to use | |
*@rating - rating of Gravatar(G, PG, R, X) | |
*/ | |
function show_gravatar($email, $size, $default, $rating) | |
{ |
OlderNewer