You are not logged in.

#351 2011-08-03 16:09:17

livibetter
Member
From: Taipei
Registered: 2008-05-14
Posts: 95
Website

Re: A script proclaiming Arch's superiority

doxanthropos wrote:

What good is a message if you don't make sure, that it's understood?
So with next to none python knowledge I put together this:

#!/usr/bin/env python2
answer = "no answer yet"
while answer != "y" :
        print "Arch is best!"
        print "Do you agree?(y/n)"
        answer = raw_input()
        if answer == "n" :
                print "Maybe you should reconsider your opinion."
        elif answer != "n" and answer != "y" :
                print "There are only two possible answers and this is none of them."
print "Glad you agree!"

Made a few changes:

#!/usr/bin/env python2

import signal
import sys

def arch_is_the_best(are_the_cats_out=False):
        answer = "no answer yet"
        what = "the best"
        if are_the_cats_out:
                what = "DA GUD KITTEH"
        while answer != "y" :
                try:
                        print "Arch is %s!" % what
                        print "Do you agree?(y/n)",
                        answer = sys.stdin.readline().rstrip('\n')
                        print
                        if answer == "n" :
                                print "Maybe you should reconsider your opinion."
                        elif answer != "y" :
                                print "There are only two possible answers and this is none of them."
                        print
                except KeyboardInterrupt:
                        print
                        print "What are you trying to do?"
                        what = "devilish"
                        pass

def let_the_cats_out(signum, frame):
        print
        print
        print "U R BAD BAD BAD KITTEH!"
        print
        arch_is_the_best(True)

for signum in range(32):
        try:
                signal.signal(signum, let_the_cats_out)
        except:
                pass
# Shush... Kitten says nyan nyan da SIGKILL.

if __name__ == "__main__":
        arch_is_the_best()
        print "Glad you agree!"

Save it as aitb.py and run it (run at you own risk, be warned!):

 while :; do python aitb.py ; done

(Kitten says I am innocent, kitten doesn't know why kitten is here. Because Arch is the best?)

Offline

#352 2011-08-04 00:12:34

markbabc
Member
Registered: 2010-11-06
Posts: 157

Re: A script proclaiming Arch's superiority

doxanthropos wrote:

This thread convinced me to try Arch. It must be the best!
Unfortunately it seems as if the suggestion of headhunter242 has gone nearly unnoticed:

headhunter242 wrote:

Maybe you are missing the fundamental of programming...

http://img110.imageshack.us/img110/2558 … ramrv0.png

As you can see you can express your free opinion!

What good is a message if you don't make sure, that it's understood?
So with next to none python knowledge I put together this:

#!/usr/bin/env python2
answer = "no answer yet"
while answer != "y" :
        print "Arch is best!"
        print "Do you agree?(y/n)"
        answer = raw_input()
        if answer == "n" :
                print "Maybe you should reconsider your opinion."
        elif answer != "n" and answer != "y" :
                print "There are only two possible answers and this is none of them."
print "Glad you agree!"

oh gosh this is arch, update to python3.x!

#!/usr/bin/env python
answer = ""
while answer != "y" :
        answer = input("Arch is best!\nDo you agree?(y/n)").lower()
        if answer == "n" :
                print("Maybe you should reconsider your opinion.")
        elif answer != "n" and answer != "y" :
                print("There are only two possible answers and this is none of them.")
print("Glad you agree!")

Offline

#353 2011-08-08 01:02:15

MetaMan
Member
Registered: 2011-08-08
Posts: 43

Re: A script proclaiming Arch's superiority

I have ported this awesome program to Vala, with a command line version and a GUI.

Here is the CLI version:

void main(string[] args) {
stdout.printf("\nArch is the best!\n\n");
}

To compile, save as aitb.vala and compile with "valac aitb.vala"

The GUI version:

using GLib;
using Gtk;

public class AITB : GLib.Object {
    public static int main(string[] args) {
        Gtk.init(ref args);
        
        var window = new Window();
        var label = new Label("Arch is the best!");
        
        window.title = "Arch is the best!";
        window.set_default_size(250, 100);
        window.destroy.connect(Gtk.main_quit);
        
        window.add(label);
        window.show_all();
        
        Gtk.main();
        return 0;
    }
}

To compile, save as aitb_gui.vala and compile with "valac --pkg gtk+-3.0 aitb_gui.vala" (Assuming you've updated to GNOME 3)


http://localhost/signature.txt
Error 403: Forbidden

Offline

#354 2011-10-29 09:57:28

VOT Productions
Member
Registered: 2011-10-22
Posts: 41

Re: A script proclaiming Arch's superiority

I'm suprised no one said Visual Basic .NET:

 Module ArchLinux
 
    Sub Main()
        Console.WriteLine("Arch Linux is the best!")
    End Sub
 
End Module 

Whoops sorry for bumping but this project is so active.

Last edited by VOT Productions (2011-10-29 09:59:18)

Offline

#355 2011-10-30 02:53:17

Ogion
Member
From: Germany
Registered: 2007-12-11
Posts: 367

Re: A script proclaiming Arch's superiority

Arch Superiority, the Ruby way

#!/usr/bin/ruby
# coding: utf-8
# aitb.rb
# claiming Arch Superiority

require 'open-uri'

class Aitb
    def initialize
        @source = open('https://wiki.archlinux.org/index.php?title=Arch_is_the_best&printable=yes').read
        @myrex = %r!"Translations">Translations</span></h2>(.*?)<h2> <span class="mw-headline" id="Links"!m
    end

    def make_hash
        #getting the translations out of the whole page
        translations = @source.match(@myrex)[1]
        # creates an array with one array element = one language
        transarray = translations.gsub(/pre>\n<p><b>/, '|').split("|")
        # kill superfluous html tags
        transarray.collect! {|x| x.gsub(/\n/, "").gsub(%r!<[/pb]+>!, "").gsub(%r!</.*$!,"") }
        # creating a hash of the form "languagename" => "archisbest"
        transhash = transarray.each_with_object({}) {|x,hash| a,b = x.split("<pre>"); hash[a] = b }
        return transhash
    end

    def isArchSuperior?
        hash = make_hash
        # claiming superiority, babylon style
        hash.each_pair {|x,y| puts "Arch Superiority in #{x}: #{y}"}
    end
end

Aitb.new.isArchSuperior?

Takes the list of language translations straight from the wiki each time it runs.

Ogion


(my-dotfiles)
"People willing to trade their freedom for temporary security deserve neither and will lose both." - Benjamin Franklin
"Enlightenment is man's leaving his self-caused immaturity." - Immanuel Kant

Offline

#356 2011-10-31 14:39:49

toad
Member
From: if only I knew
Registered: 2008-12-22
Posts: 1,775
Website

Re: A script proclaiming Arch's superiority

Berlin dialect:

Arch is dufte!


never trust a toad...
::Grateful ArchDonor::
::Grateful Wikipedia Donor::

Offline

#357 2013-11-01 13:41:52

crom
Member
From: Germany
Registered: 2008-05-11
Posts: 43

Re: A script proclaiming Arch's superiority

ckristi wrote:

[backtrack] Linus said it must be thoroughly tested (so everyone, pick a copy of Arch and do it)... and maybe it will be merged upstream in the 3.0.x or 3.2.x version of the kernel. ;-)

We are past 3.2 already... someone should remind him. big_smile

Last edited by crom (2013-11-01 13:44:54)

Offline

Board footer

Powered by FluxBB