Του εφτιαξα και ενα απλο interface σε php γιατι βαριομουν.

http://cypher.dontexist.net/rhymefinder/index.php
cypha έγραψε:Εφτιαξα ενα σημειο στο scriptaki του AmmarkoV/c00kiemon5ter που εβγαζε ριμες οταν του εβαζες καταληξεις. Εβαλα και switches και αγγλικο λεξικο οποτε δουλευει για αγγλικα και ελληνικα.
Του εφτιαξα και ενα απλο interface σε php γιατι βαριομουν.![]()
http://cypher.dontexist.net/rhymefinder/index.php
...scripts...
cypha έγραψε:Έγραψε σήμερα ο c00kie μερικές εντολές για να κατεβαίνουν αυτόματα όλες οι εικόνες απο τα webcomics: xkcd, cyanide and happiness, 8-bit theater, how i kiled your master, atomic robo και The order of the stick.
- Κώδικας: Επιλογή όλων
...scritps...
#!/bin/bash
#A simple script for automating the system backup.
prefix="system_backup_"
data="/etc /home /root /var/www /var/log /var/spool/mail"
backup_dir="/var/backups"
num_of_backups=4
while [ $(ls -1 $backup_dir | grep $prefix* | wc -l) -ge $num_of_backups ];
do
rm $(ls -1t $backup_dir/$prefix* | tail -1)
done
/bin/tar -czf $backup_dir/system_backup_`date +%Y-%m-%d`.tar.gz $data > /dev/null 2>&1
chown root:root $backup_dir/$prefix*
chmod o-rwx $backup_dir/$prefix*
#!/usr/bin/env bash
## a simple script for automating the system backup.
(( $UID )) && { echo 'you need to be root to run this script'; exit 1; }
prefix='system_backup_'
data=(/etc /home /root /var/www /var/log /var/spool/mail)
backup_dir="/var/backups"
num_of_backups=4
while (( $(wc -l < <(ls "$backup_dir/$prefix"*)) <= $num_of_backups )); do
rm -rf $(ls -1t $backup_dir/$prefix* | tail -1)
done
/bin/tar -czf "$backup_dir/system_backup_$(date +%Y-%m-%d).tar.gz" ${data[@]} &>/dev/null
# owned by root and only readable by Him
chown root:root $backup_dir/$prefix*
chmod 400 $backup_dir/$prefix*
#!/usr/bin/env perl
# 22-10-2011 - Periklis Master_ex Ntanasis <pntanasis@gmail.com>
#
# Usage: grammateia-stats.pl <link-to-e-grammateia-page-with-lesson's-grades>
#
use Encode;
$egrmmateiapage = $ARGV[0];
$page = `curl '$egrmmateiapage' | sed -n 486p`;
$page = decode('Windows-1253',$page);
#<tr height="25"><td valign="top"><span class="tablecell">3990143</span></td><td valign="top"><span class="tablebold">5</span></td><td class="tablecell" valign="top">ΣΕΠΤ</td></tr>
for($i=0;$i<=10;$i=$i+0.5) {
$grades{$i}=0;
$grades_sep{$i}=0;
$grades_fj{$i}=0;
}
$total=0;
$passed=0;
$passed_sep=0;
$passed_fj=0;
while ( $page =~ m~(\d{7})</span></td><td valign="top"><span class="\w+">(\d+(,\d+)?)</span></td><td class="tablecell" valign="top">(\w{4})~g) {
$grade = $2;
$grade =~ s/,/./;
$semester = encode('UTF-8',$4);
$total++;
$grades{$grade}++;
if ($grade >= 5.0) {
$passed++;
}
if ($semester eq "ΣΕΠΤ") {
$grades_sep{$grade}++;
$total_sep++;
if ($grade >= 5.0) {
$passed_sep++;
}
} else {
$grades_fj{$grade}++;
$total_fj++;
if ($grade >= 5.0) {
$passed_fj++;
}
}
}
print "Results Overall\n";
print "Grade \t Total \t % \t %passed\n";
for($i=0;$i<=10;$i=$i+0.5) {
$res = ($grades{$i}/$total)*100;
if ($i >= 5.0) {
$pass = ($grades{$i}/$passed)*100;
printf("%.1f \t %s \t %.2f \t %.2f\n",$i,$grades{$i},$res,$pass);
} else {
printf("%.1f \t %s \t %.2f \t ----\n",$i,$grades{$i},$res);
}
}
print "Total: $total\n";
print "Results (February or June)\n";
print "Grade \t Total \t % \t %passed\n";
for($i=0;$i<=10;$i=$i+0.5) {
$res = ($grades_fj{$i}/$total)*100;
if ($i >= 5.0) {
$pass = ($grades_fj{$i}/$passed_fj)*100;
printf("%.1f \t %s \t %.2f \t %.2f\n",$i,$grades_fj{$i},$res,$pass);
} else {
printf("%.1f \t %s \t %.2f \t ----\n",$i,$grades_fj{$i},$res);
}
}
print "Total: $total_fj\n";
print "Results September\n";
print "Grade \t Total \t % \t %passed\n";
for($i=0;$i<=10;$i=$i+0.5) {
$res = ($grades_sep{$i}/$total)*100;
if ($i >= 5.0) {
$pass = ($grades_sep{$i}/$passed_sep)*100;
printf("%.1f \t %s \t %.2f \t %.2f\n",$i,$grades_sep{$i},$res,$pass);
} else {
printf("%.1f \t %s \t %.2f \t ----\n",$i,$grades_sep{$i},$res);
}
}
print "Total: $total_sep\n";
print $passed_sep;
Results Overall
Grade Total % %passed
0.0 6 1.57 ----
0.5 0 0.00 ----
1.0 29 7.59 ----
1.5 16 4.19 ----
2.0 24 6.28 ----
2.5 28 7.33 ----
3.0 22 5.76 ----
3.5 17 4.45 ----
4.0 0 0.00 ----
4.5 0 0.00 ----
5.0 95 24.87 39.58
5.5 19 4.97 7.92
6.0 59 15.45 24.58
6.5 26 6.81 10.83
7.0 10 2.62 4.17
7.5 11 2.88 4.58
8.0 6 1.57 2.50
8.5 5 1.31 2.08
9.0 1 0.26 0.42
9.5 6 1.57 2.50
10.0 2 0.52 0.83
Total: 382
Results (February or June)
Grade Total % %passed
0.0 5 1.31 ----
0.5 0 0.00 ----
1.0 15 3.93 ----
1.5 16 4.19 ----
2.0 7 1.83 ----
2.5 28 7.33 ----
3.0 7 1.83 ----
3.5 17 4.45 ----
4.0 0 0.00 ----
4.5 0 0.00 ----
5.0 61 15.97 30.96
5.5 19 4.97 9.64
6.0 55 14.40 27.92
6.5 26 6.81 13.20
7.0 7 1.83 3.55
7.5 11 2.88 5.58
8.0 5 1.31 2.54
8.5 5 1.31 2.54
9.0 1 0.26 0.51
9.5 6 1.57 3.05
10.0 1 0.26 0.51
Total: 292
Results September
Grade Total % %passed
0.0 1 0.26 ----
0.5 0 0.00 ----
1.0 14 3.66 ----
1.5 0 0.00 ----
2.0 17 4.45 ----
2.5 0 0.00 ----
3.0 15 3.93 ----
3.5 0 0.00 ----
4.0 0 0.00 ----
4.5 0 0.00 ----
5.0 34 8.90 79.07
5.5 0 0.00 0.00
6.0 4 1.05 9.30
6.5 0 0.00 0.00
7.0 3 0.79 6.98
7.5 0 0.00 0.00
8.0 1 0.26 2.33
8.5 0 0.00 0.00
9.0 0 0.00 0.00
9.5 0 0.00 0.00
10.0 1 0.26 2.33
Total: 90
#!/usr/bin/env python
#*
#* The MIT License
#*
#* Copyright 2012 Georgios Migdos <cyberpython@gmail.com>.
#*
#* Permission is hereby granted, free of charge, to any person obtaining a copy
#* of this software and associated documentation files (the "Software"), to deal
#* in the Software without restriction, including without limitation the rights
#* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
#* copies of the Software, and to permit persons to whom the Software is
#* furnished to do so, subject to the following conditions:
#*
#* The above copyright notice and this permission notice shall be included in
#* all copies or substantial portions of the Software.
#*
#* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
#* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
#* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
#* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
#* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
#* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
#* THE SOFTWARE.
#*
from gi.repository import Gtk, GtkSource
import sys
if len(sys.argv)!=5 :
print '''
Wrong number of parameters:
Correct usage :
python source_printer.py <language_id> <scheme_id> <font_description> <filename>
e.g.
python source_printer.py java classic "Liberation Mono 10" ~/test/Hello_World.java
Parameters:
language_id : The GtkSourceView language definition id.
scheme_id : The GtkSourceView style scheme definition id.
font_description : The Pango font description string (font-family
and size seperated by a space character).
filename : The file to print.
'''
exit()
def begin_print(operation, context, p):
print "Initializing printing process..."
while(not p.paginate(context)):
pass
n_pages = p.get_n_pages()
operation.set_n_pages (n_pages);
print "Sending", n_pages, "to printer"
def end_print(operation, context):
print 'Document sent to printer.'
def draw_page(operation, context, page_nr, p):
print 'Sending page:', (page_nr+1)
p.draw_page (context,page_nr)
fname = sys.argv[4]
lang = GtkSource.LanguageManager.get_default().get_language(sys.argv[1])
scheme = GtkSource.StyleSchemeManager.get_default().get_scheme(sys.argv[2])
buf = GtkSource.Buffer()
buf.set_language(lang)
buf.set_style_scheme(scheme)
f = open(fname, 'r')
buf.set_text(f.read())
f.close()
p = GtkSource.PrintCompositor.new(buf)
p.set_body_font_name(sys.argv[3])
p.set_left_margin(20, Gtk.Unit.MM)
p.set_right_margin(20, Gtk.Unit.MM)
p.set_top_margin(20, Gtk.Unit.MM)
p.set_bottom_margin(30, Gtk.Unit.MM)
op = Gtk.PrintOperation()
op.connect("draw_page", draw_page, p)
op.connect("begin-print", begin_print, p)
op.connect("end-print", end_print)
op.run(Gtk.PrintOperationAction.PRINT, None)