Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Monday, November 06, 2017

How to set a PIN password or a short password in Ubuntu Linux

If you are looking for a way to a PIN password or a short password in Ubuntu Linux, similar to Windows 10, you've come to the right place.
The way described here changes only the desktop login (lightdm service), but can be applied to other services as well if you wish.
Also, this allows you to have your original strong password for "sudo", while maintaining a fairly easy way to login to Ubuntu desktop.
Commands can be issued in the terminal program.

Installing pam_pwdfile.so

First of all, make sure you have installed the libpam-pwdfile package:
sudo apt-get install libpam-pwdfile

Creating the user/password file

You will be prompted to enter a new PIN password.
Your password will be encrypted and saved to a file named "passwd.like"


pinpass=$(mkpasswd -5)
echo "$pinpass" | sudo tee /etc/passwd.like


You will see the encrypted pin password echoed in the terminal. This password will be written to the /etc/passwd.like file.

Alternatively, you may use:
openssl passwd -1 yourpinpasswordhere


Setting up the desktop login service

The next step is to prepare the desktop login service to accept the PIN password before other password procedures. I've mentioned already the name of the desktop login service, lightdm .

Take a look at the file:

cat /etc/pam.d/lightdm

If you don't have this file, then your desktop (login) service is a different one, and you should find your desktop manager before going further. As explained before, this guide is for Ubuntu 16.04 but can be used for other login services as well.

It could be useful if you also create a backup:

sudo cp /etc/pam.d/lightdm /etc/pam.d/lightdm.backup

Now, you may edit the file using nano or gedit or any other  text editor:
sudo gedit /etc/pam.d/lightdm

At the top of the file mine had:



#%PAM-1.0
auth    requisite       pam_nologin.so
auth    sufficient      pam_succeed_if.so user ingroup nopasswdlogin
@include common-auth

I have modified it like so:




#%PAM-1.0
auth requisite pam_nologin.so
auth sufficient pam_succeed_if.so user ingroup nopasswdlogin
auth required pam_pwdfile.so pwdfile=/etc/passwd.like
auth required pam_permit.so
#
@include common-auth

Save the file and close your text editor.

Log out and log back in.

You should be able to use the PIN password you set. By following this guide, the PIN password is only used for the desktop login service, not for the password of sudo commands.

Sources:
This is a modified guide based on a pam pwdfile guide for vsftpd at: http://www.rollnorocks.com/2015/11/authenticating-vsftpd-virtual-users-with-pam_pwdfile-so/


Monday, August 24, 2015

How to issue a time resynchronization in Windows - cmd/batch

 Hello again, I'm back. I found some spare time to add some updated tricks concerning technology, and general tips for Windows or GNU/Linux. :)

I've been having some problems with the time synchronization in Windows 7, which required more often synchronization. So after some googling around, I came up with this little batch commands:
echo Current date/time: %date%_%time%
%windir%\system32\sc.exe start w32time task_started
%windir%\system32\w32tm.exe /resync
echo Fixed date/time: %date%_%time%
pause

Save it as a .bat file and run it as an administrator (right-click on file > Run as administrator).
It's nothing much, pretty dirty scripting I confess, but it does get the job done, at least in my case. I hope it will help someone else too.

See ya!

Thursday, July 26, 2012

python: download url to file with progress bar

This is an alternative answer for a question on stackoverflow:
http://stackoverflow.com/a/22776/286994

I modified the answer a bit, using .format instead of % string formatting and sys.stdout.write(), and posted it on gist github: https://gist.github.com/3176958

#!/usr/bin/python
# Improve http://stackoverflow.com/a/22776/286994
# (using .format() instead of % string formatting)

import sys
import urllib2

file_name = url.split('/')[-1]
u = urllib2.urlopen(url)
f = open(file_name, 'wb')
meta = u.info()
file_size = int(meta.getheaders("Content-Length")[0])
print("Downloading: {0} Bytes: {1}".format(url, file_size))

file_size_dl = 0
block_sz = 8192
while True:
    buffer = u.read(block_sz)
    if not buffer:
        break

    file_size_dl += len(buffer)
    f.write(buffer)
    p = float(file_size_dl) / file_size
    status = r"{0}  [{1:.2%}]".format(file_size_dl, p)
    status = status + chr(8)*(len(status)+1)
    sys.stdout.write(status)

f.close()

I'm using this solution for the kernel mainline ppa downloader: https://github.com/medigeek/kmp-downloader

Monday, April 02, 2012

Hiren's boot cd using unetbootin (missing boot options)



If you try to use unetbootin to copy Hiren's bootcd on a usb flash drive and you boot using the flash disk, you'll notice that some options are missing, especially the "mini windows xp" boot option.

To overcome this problem you have to copy the file "HBCD/isolinux.cfg" to the main folder and replace the file "syslinux.cfg"

Then everything will work as expected.

Bug report: https://bugs.launchpad.net/unetbootin/+bug/971403

Monday, March 05, 2012

Now you can read xps files in ubuntu!

About
  OpenXPS or XPS stands for XML Paper Specification. It is based on XML and it's a new electronic paper format originally developed by Microsoft and it serves as a PDF alternative. XPS files are usually created using "Microsoft XPS Document Writer" in Windows environments. It is now standardized as an open standard document format.

Quoting Wikipedia:
 An XPS file is in fact a Unicoded ZIP archive using the Open Packaging Conventions, containing the files which make up the document. These include an XML markup file for each page, text, embedded fonts, raster images, 2D vector graphics, as well as the digital rights management information. The contents of an XPS file can be examined simply by opening it in an application which supports ZIP files.

 The OpenXPS document format specification supports features such as color gradients, transparencies, CMYK color spaces, printer calibration, multiple-ink systems and print schemas.

 Evince already supports xps, but it has to be compiled with that option enabled. In order for evince (the program that allows you to read pdf document files) to read xps files, libgxps is required first.

Status update
..for libgxps in Debian (we'll see about Ubuntu afterwards):



There's a PPA!
After much frustration, I have created a PPA for evince with xps: https://launchpad.net/~medigeek/+archive/evince-xps/

Note: The evince version in Ubuntu 11.10 oneiric ocelot doesn't work with xps (segmentation fault when opening the file) and there are several packages to be backported. I've decided not to backport it. It works in Ubuntu 12.04 precise pangolin.
If you need to read an xps file, package libgxps-utils provides enough conversion tools, e.g. command:
xpstopdf myfile.xps

Friday, March 02, 2012

Libreoffice recent documents - History manager extension

This solution works for Windows operating systems as well as Linux distributions (It's actually system independent)
If you need to clear or define how many items the recent documents list bears, you can install this easy-to-use extension/addon/plugin: History manager for Libreoffice/Openoffice

- Click "Get it" and download the .oxt file.
- Open Libreoffice writer, menu > Tools > Extension manager > press Add and open the .oxt file you've downloaded.
- Close Libreoffice and re-open it. Go to menu Tools > Add-ons > History manager

Tuesday, February 28, 2012

How to set default apps (aka how to use xdg-mime)

How to set default apps in Chromium / Chrome / Firefox / Ubuntu Linux

Situation: You hate the default app that opens when you double click a file or when you open it with chromium browser and you want to change it.

a) In Unity (and probably Gnome 3 Shell), some default apps can be changed through gnome-control-center: System settings > System info > Default applications



b) You can also right-click on a file > select Properties > Open with. See what applications/programs are listed there. You can also add them and set them as default.


c) If none of the above work, you can use xdg-utils (xdg-mime) to set a default application for a specific Mime Type

First, you have to figure out what text string to use as a "mime type". An easy way to find it is to look into the default application's desktop file.

Example: Chromium opens magnet links and bittorrent files with transmission-gtk by default. The .desktop files are usually in folder /usr/share/applications/. We use "cat" command to look into the file /usr/share/applications/transmission-gtk (a line that starts with "MimeType"):

$ cat /usr/share/applications/transmission-gtk.desktop
[Desktop Entry]
Name=Transmission
[...]
Exec=transmission-gtk %U
Icon=transmission
Terminal=false
TryExec=transmission-gtk
Type=Application
MimeType=application/x-bittorrent;x-scheme-handler/magnet;
Categories=Network;FileTransfer;P2P;GTK;

Bingo! x-scheme-handler/magnet and application/x-bittorrent are the mime types we're after.

How to use xdg-mime command? Simple: xdg-mime default myapp.desktop mymimetype

..where we substitute myapp.desktop and mymimetype with the values from above.

Following the example above, we want magnet links and bittorrent files to open with Deluge (deluge-gtk) application. First you have to install the deluge-gtk package (otherwise the .desktop file won't exist). Then you have to execute:

xdg-mime default deluge.desktop x-scheme-handler/magnet
xdg-mime default deluge.desktop application/x-bittorrent
grep -i deluge ~/.local/share/applications/*

The last command (grep) should return "application/x-bittorrent=deluge.desktop" and the other mime type for magnet. Otherwise, something went wrong (maybe the desktop file didn't exist?).

And that's about it! Close and open chromium-browser again (or logout/login).

For the sake of documentation, the files that have to do with mime types and default apps are:

~/.local/share/applications/defaults.list
~/.local/share/applications/mimeapps.list
~/.local/share/applications/mimeinfo.cache
/usr/share/applications/mimeinfo.cache
/usr/share/applications/mimeapps.list
/usr/share/applications/defaults.list

Saturday, February 11, 2012

How to install 1385:5f01 Netgear WPN111 (ar5523 driver)

Bus 002 Device 004: ID 1385:5f01 Netgear, Inc WPN111 (no firmware)
If you have the above device or a usb wifi dongle that requires ar5523 driver, you can try the commands and packages I've documented in order to make it work.

The weird thing with this device is that the firmware adds +1 to its ID. If you look at the code (SVN repository), you'll see that it's registered as "1385:5f00".

How to install the device driver
1. Install this package, depending on the version of ubuntu you may have:

2. Execute the following commands, copy-paste them one by one:
sudo apt-get update
sudo apt-get -f install
sudo apt-get upgrade
sudo apt-get install build-essential linux-headers-generic module-assistant
sudo m-a a-i ar5523-source
wget http://verein.lst.de/~hch/ar5523.tgz
tar xvf ar5523.tgz ar5523/uath-ar5523.bin --strip 1
sudo mv uath-ar5523.bin /lib/firmware

3. Restart your computer and replug your usb dongle. Hopefully it works. :)


Source(s):

Friday, January 27, 2012

Ubuntu Server Guide στα ελληνικά


 Μετά από παρότρυνση ενός μέλους του ubuntu-gr στην ταχυδρομική λίστα (ubuntu-gr mailing list) και με λίγη βοήθεια από τον Σίμο, καταφέραμε να δημιουργήσουμε τον οδηγό "Ubuntu server guide" ως PDF στα ελληνικά.

 Φυσικά, η μετάφραση ήδη υπάρχει ως HTML: http://help.ubuntu-gr.org/10.04/serverguide/el/

 Το πρόβλημα φαίνεται να ήταν με τη δημιουργία PDF αρχείου. Εμφάνιζε "####" χαρακτήρες αντί τους ελληνικούς.

 Το serverguide διασπάστηκε πριν λίγο καιρό από το ubuntu-docs και δημιουργήθηκε καινούργιο project: https://launchpad.net/serverguide
 Aπό εκεί βρήκα τις πιο πρόσφατες μεταφράσεις:

https://translations.launchpad.net/serverguide/

https://translations.launchpad.net/serverguide/oneiric/+pots/serverguide/el/+details

 Τώρα, πώς μεταφράζουμε τον οδηγό και πώς δημιουργούμε το pdf; Εκτελούμε τις εξής εντολές:

sudo apt-get install xsltproc bzr fop gnome-doc-utils docbook-xsl libservlet2.5-java
bzr branch lp:serverguide
cd serverguide
mkdir po

Μετά πάτε στο https://translations.launchpad.net/serverguide/oneiric/+pots/serverguide/el/+export
Ζητάτε το αρχείο ως .po (PO format). Θα σταλεί στο email.

Μετονομάζετε το αρχείο ως el.po
Μεταφέρετε το el.po στο φάκελο po/

Patch-άρετε το bzr tree:

wget http://people.ubuntu.com/~medigeek/serverguide_el/bzrpatch.diff -O bzrpatch.diff
bzr patch bzrpatch.diff

Για να δημιουργήσετε html:
make serverguide LN=el

Για να δημιουργήσετε pdf:

make serverguide-pdf LN=el

 Το pdf στα ελληνικά με Ubuntu fonts: http://people.ubuntu.com/~medigeek/serverguide_el/pdf/serverguide.pdf

  Το πρόβλημα με τα fonts αναφέρθηκε ως σφάλμα:

https://bugs.launchpad.net/serverguide/+bug/922251

Monday, August 24, 2009

Blogger and Firefox - How to save your password

 Some websites don't allow you to save your password in Firefox built-in password manager, for example Yahoo and Blogger. Really irritating!

 One beautiful day (my irony tends to build up under 35 degrees Celsius), I noticed that the Blogger page actually redirects you to a Google account sign in. Therefore, I've come up with this little link that will allow you to save your password and take you back to Blogger:


https://www.google.com/accounts/ServiceLogin?service=blogger&continue=http://www.blogger.com/

Someone might make a good use of it. I also hope someone will find a way or fix the yahoo login page. Enjoy!

P.S. Make sure you install Secure Login add-on - it's a really handy application that allows one-click installs!

Wednesday, August 19, 2009

Workaround: brasero - slow speeds while burning

Brasero is a cd/dvd writing application for the Gnome desktop manager. Its advantages are ease of use, a lot of burning options and support for plugins!

Currently in Ubuntu 9.04, if you try to burn a disc, you might notice that:

  • Everything goes well until about 50%.
  • Afterwards, it continues, but the report does not show anything (empty progress bar).
  • The speed is less than 2x, from 600 KiB/s to 800KiB/s, but the burning keeps going.
  • Somewhere in the end, brasero shows progress again, but starts from 0%!!
  • Burn was successful.
Note: You should consider that this might not always be your issue with slow speeds. For example, maybe your drive is not working well, or maybe your power supply unit (PSU) does not have enough "W" to supply all your hardware with adequate power.

The bug information is extensively reported here:
http://bugzilla.gnome.org/show_bug.cgi?id=582261

One of the developers detected and corrected the problem, which seems that it was using the wrong plugin ("wodim" instead of "growisofs"). Since Ubuntu's binary package brasero has wodim as a dependency, it might cause problems if you try to remove wodim.

There is a workaround though that seems to do the trick:

Don't forget to install the package for growisofs: dvd+rw-tools

1. Tell brasero to use growisof:
  - Press Alt+F2, and execute this command:
gconf-editor 

  - Head to apps ⟶ brasero ⟶ config ⟶ priority.
  - Change the number "0" next to wodim-burn to "-1" in order to disable it.
  - Change the number "0" next to growisofs-burn to "1" in order to set a higher priority.



2. Instead of using "Max" in speed burning options, set it manually at a high speed - e.g. choose 16x for a DVD or 52x for a CD.

That's it!


Credits go to:
https://bugs.launchpad.net/ubuntu/+source/brasero/+bug/370999/comments/15
https://bugs.launchpad.net/ubuntu/+source/brasero/+bug/370999/comments/16

Friday, April 24, 2009

belimantil.info hacked

About 2 days ago, I saw this on belimantil.info:




Astounded my first thought was "What the hell?!". I was looking for a revision text one of my colleagues wrote, and fortunately it was available on another site. medforum2 (a forum created by medical students for general talk, exams and medicine-related discussion) was hosted on that domain, I thought of visiting and saw one of my colleagues complaining about the same thing.

Today I re-visited the site, only to find that it wasn't working! Naturally, my techie side kicked in several minutes afterwards, and I started looking into whether it was their fault (probably) or the web administration (why not?). So the whois command revealed the nameserver, I decided to visit oklopsrbija.com, their hosting provider.

Poštovani klijenti,

Prekjuce je izvrsen napad velike grupe palestinskih hakera koji su "u borbi protiv Izraelaca" uspeli da zaobidju sve zastite na serveru i ishakuju sve naloge. Juce je ceo dan bila rekonstrukcija fajlova i pojacanje zastite.
Nocas je uglavnom proradilo sve. Otezan je jos pristup cPanelu. Klijenti kojima je hakovanjem ostecena indeks stranica a nemaju backup tog fajla, neka ostave ticket sa subjectiom: "backup index fajla" i uradice se parcijalni restore podataka za te klijente, pocevsi od petka ujutru, i samo za klijente koji zatraze restore indeks fajla. U nemogucnosti smo da uradimo full restore svih podataka posto je vecina sajtova, pogotovu foruma, vec online i pregazili bi tim full restore njihove sveze podatke.Probijanje zastite nije nista novo na internetu, postala je nazalost svakodnevnica, igrom slucaja smo prekjuce odabrani mi.
Ako hakeri mogu da provale u NASA ili Pentagon servere, sto ne bi i kod nas. I nismo prvi a na zalost ni poslednji domaci provajder koji je imao komplet ishakovan server.Takodje vas molimo da pratite dalja obavestenja logovanjem na vas oklopov nalog i pregledanje sekcije "Obavestenja".
S poštovanjem,
Vojin Petrović
direktor Oklop Srbija

In short, they are claiming that "Security breaking is nothing new on the internet, it has become an everyday event unfortunately, by chance we were chosen the day before yesterday" and "If hackers can break into NASA or Pentagon servers, why wouldn't they break into ours?". If understood them correctly, they're claiming it's not their fault they're not secure. Not even a single "We are sorry for not being careful" or "We'll take extra security steps to provide you with a safer hosting in the future" sentence. What an arrogance! I guess they should scratch the word on their website title, "Pouzdan" (=Reliable).

P.S. I hope this doesn't happen to me :)

Monday, December 29, 2008

How to change default locale (Ubuntu GNOME)

  I have always been a fan of English as my main language while using the computer or computer-related terminology. Recently I've stumbled upon the screenlets package (see picture or install debian package).
The only problem is that using United States' default date is shown as Month/Date/Year (i.e. 29/12/2008), which is rather unattractive (hey - my eyes, my brain, my opinion, my choice!).
  After many unsuccessful tries of various commands, I've come up with a rather graphical-based solution to use the locale I preferred. Obviously, the best choice for me would be en_GB (Great Britain/United Kingdom), since I wanted to stick with English, but use the date format Date/Month/Year.
  1. System > Admnistration > Language Support
Or you can simply run the command: gnome-language-selector
  2. Type in your password if asked to do so. (Make sure you're the adminsitrator, it might involve installing extra packages)
  3. Install your language of preference.
  4. Choose the language of your choice again as the "Default language".
  5. Press "Apply" and click "OK".
  6. Log out (System > Log out).
  7. While viewing the Login screen, click "Options" (lower left corner in Ubuntu), then "Set Language" and select "System Default". It will ask you to restart the login screen (press "Yes").
  8. When the login screen is restarted, you will be using the language of your preference with the appropriate locale! :) You should be able to check this out when you run the following command in Terminal (Applications > Accessories > Terminal):
locale

LANG=en_GB.UTF-8
LC_CTYPE="en_GB.UTF-8"
LC_NUMERIC="en_GB.UTF-8"
LC_TIME="en_GB.UTF-8"
LC_COLLATE="en_GB.UTF-8"
LC_MONETARY="en_GB.UTF-8"
LC_MESSAGES="en_GB.UTF-8"
LC_PAPER="en_GB.UTF-8"
LC_NAME="en_GB.UTF-8"
LC_ADDRESS="en_GB.UTF-8"
LC_TELEPHONE="en_GB.UTF-8"
LC_MEASUREMENT="en_GB.UTF-8"
LC_IDENTIFICATION="en_GB.UTF-8"
LC_ALL=


Now, if you notice any problems:
1. Execute these commands in terminal:
sudo -s

echo 'PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games"' > /etc/environment

2. Reboot your computer.
3. Run the gnome language selector again, choose "English (United States)" (or whatever was the default language). Press Apply and OK. Run it once more and set it again to the language you want it to be ("English (United Kingdom)"), press Apply and OK.
4. Follow the steps 6, 7 and 8 above.
You ought to be able to have the default language and locale you selected!

Monday, November 24, 2008

non-ASCII characters in usernames

Ever wanted a user name that is localised to the language you want, with your original name or surname and not only using Latin characters? Well, today I made a beautiful discovery!

Although a lot of people claim it is not possible yet for GNU/Linux to understand characters other than ASCII, I've found that it can concerning user names - using the useradd command (not adduser).

The actual problem seems to be a standard the unix commands have to follow:
http://www.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap03.html

But it looks like the useradd accepts arbitrary usernames, which is cool! So I've tried my name in Greek:
sudo useradd -m Σάββας

Then adding a password:
sudo passwd Σάββας

And that is all that is required!! Maybe some programs aren't ready yet, but so far I've tried: terminal, console, firefox, rhythmbox, totem player. None of them returned any errors nor did they crash.

Sunday, October 26, 2008

timekpr - Keep control of your computer usage

A rather new project, really reaaally really useful for parents and administrators that wish to limit their user accounts to a certain amount of login access duration or to limit accounts by defining access hours. Either way, it's a must have application, which I'm *ahem* actively co-developing! :)

The project page can be found at LaunchPad, the code is hosted at LaunchPad too! We have also set up a new blog for it at blogspot: http://timekpr.blogspot.com. There's a voting poll at the blog site, you might be interested to "give your click" to provide us with an orientation as to which new toys should timekpr focus on. ;)

I'm hosting a mini-page regarding the Debian packages, built with Ubuntu in mind: http://savvas.radevic.com/timekpr
(until I find some time to learn to cope with uploading packages to a personal package archive ["PPA"] at Launchpad)

Monday, October 13, 2008

Openoffice 3.0 final.. finally!

Today I noticed that the new version 3.0 of OpenOffice.org will be out, the open source/free desktop office bundle (that I adore). As osalt.com describes it:
 OpenOffice provides a great alternative to existing commercial office suites. It comes with word processor (Writer), spreadsheet (Calc), presentation (Impress), drawing and graphing tool (Draw), tool for creating equations and formulae (Math) and finally a database tool which also build reports and forms (Base). All components are multi-platform and multilingual. Development is sponsored by Sun Microsystems.
So I have two events to celebrate today, this and my birthday! :)

Click on the following links to see:
- the release announcement:
www.openoffice.org/news/index.html
http://www.google.com/search?q=cache%3Ahttp%3A//www.openoffice.org/news/index.html

- the new features:
http://www.openoffice.org/dev_docs/features/3.0/
http://www.google.com/search?q=cache%3Ahttp%3A//www.openoffice.org/dev_docs/features/3.0/

I've enclosed google cache links as an alternative, for some reason the openoffice.org site replies with '403 Forbidden' error.

Update:
You can obtain the openoffice suite from torrents or mirrors such as:
torrents: http://borft.student.utwente.nl/~adrian/bt.php
mirrorservice: http://www.mirrorservice.org/sites/down ... ble/3.0.0/
Filehippo (windows executable): http://www.filehippo.com/download_openoffice/

Monday, September 29, 2008

Firefox: "Secure connection Failed"

Visiting websites with secure connection enabled can sometimes lead to problems in Firefox. Websites just link their https certificate to whatever sub-domain they want or they redirect to another website without registering it properly. Mozilla Firefox 3 detects that "glitch" and adds an extra protection layer by stating the following error:
Page load error
Secure connection Failed

*site* uses an invalid security certificate
The certificate is only valid for *another site*
(Error code: ssl_error_bad_cert_domain)

There's an easy way to resolve this, if you click on "Or you can add an exception" → "Add exception" → "Get certificate" → Read the reason it was invalid and if you're OK with the reason → "Confirm security exception".

Friday, September 12, 2008

Ranting developer

I recently stumbled upon an old thread about linux users searching for someone to create an autoit-like application for linux. Starting from this post the ranting begins, it's really fun, I went through the whole 5 pages laughing :)
Sometimes people don't understand "No", that's why developers head to the aggressive "Let me say it again: No you idiot!"

Nevertheless, if you're looking to automatize some of your basic daily work, you should be looking to learn bash scripting or even an advanced programming language such as perl or python - if you're still looking for something that handles windows and gui interface, try gambas or python-dogtail (or here).

Monday, September 01, 2008

Movie codec information - the gspot alternative

To be clear, no, I'm not talking about the ladies' G spot :) But if you're looking for GSpot Codec Information Appliance alternative tool for GNU/Linux, you're definetely looking for a tool like themonospot!
The monospot is written in C sharp (C#) using the MONO Framework and GTK#, licensed under GNU GPL, and it's a tool to extract information about various movie formats and reveals valuable information such as:
  • Video codec used
  • Frame size
  • Average video bitrate
  • File size
  • Total time
  • Frame rate
  • Total frames
  • Info data
  • Packet Bitstream
  • User data (in MOVI chunk)
  • Audio codec used
  • Average audio bitrate
  • Audio channels
This could definitely help you dig out the codec used for a specific movie you're trying to view. There various packages available for download, among them Ubuntu, Opensuse, Fedora, Windows and many more!

Friday, July 04, 2008

How to run simple local php script files without apache

Some said it's not possible. I've busted my head trying to figure out an easy way to test simple php/html scripts, which would run locally using only php, but wouldn't require running an apache server locally.




Well using two packages (which can be stripped to only one) I managed to create a bash script that will take the php script file and transform it to html (which is saved temporarily in the current directory), thus being able to run it easily in firefox. Here we go!

Firstly, install the packages, in Ubuntu:

sudo apt-get install php5-cli debianutils

From these packages we'll use the php command (php5-cli) and the tempfile command (debianutils)



Next we create the bash "phpview" convert script. Fire up the terminal (Applications > Accessories > Terminal):

gedit $HOME/phpview.sh

Inside place the following code:

#!/bin/bash
file=`tempfile -d . -s .html`
echo "Creating file: $file"
php5 $1 > $file
firefox $file
echo "Press any key to delete the temporary html file or ctrl-c to stop this script and keep it"
read
echo "Removing $file"
rm $file



Save and close the gedit text editor and make phpview.sh executable:

chmod +x $HOME/phpview.sh



That's about it, we can create a test php/html file:

gedit $HOME/Desktop/hi.php

Place in the following:

#!/usr/bin/php5 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head><title>Moo</title></head>
<body><?php echo "Hello world!"; ?></body>
</html>



Save and close.

Now let's test it!!

cd $HOME/Desktop
~/phpview.sh hi.php



Woo!