Showing posts with label Scripts. Show all posts
Showing posts with label Scripts. Show all posts

Saturday, November 30, 2013

Source Checker Script

It's been a long time since i wrote a blog post on this one. It's been a busy life ever since i had a baby girl, but i enjoyed it so i am not complaining :)

Anyway, right now i'm making some simple script to test whether an upstream source is still available or has they been deleted or moved to another place and create a broken link on the SlackBuild script at SBo project. For most of the sites upstream, my simple script worked fine, but there are several sites that rendered my script unusable and they are not a simple website. They are big vendors, such as sourceforge and Google Code.

I'm not really sure about sourceforge, but Google Code is clearly not supporting HEAD method, thus making my script failed to download from their site using wget --spider option. It worked fine using a normal wget command, but then i will need to download the file, which is something i don't really need. I just need to know whether the files are still there or not.

Any ideas on how to solve this problem? Let me know if you do :)

Update (November 30, 1: 15 AM): I'm able to check on Sourceforge.net now, but i still need to work around Google Code as some SBo scripts are hosted there as well.

Wednesday, December 14, 2011

Mass Rename Script

I need to convert bunch of files which has the same patterns and i need to do it quick, so i just created a simple bash script to help me out
#!/bin/bash

LS=`ls *`
for FILE in $LS
do
name=`ls $FILE | cut -d . -f1`
name1=`ls $FILE | cut -d . -f3`
name2=`ls $FILE | cut -d . -f4`
mv $FILE "$name.$name1.$name2"
done
So, if i have a filename with a.xxx.01.avi and i wanted to remove the xxx part, i only need to execute the script and every file with that pattern will be changed to a.01.avi.

Simple huh? big grin BASH Rock

Tuesday, November 22, 2011

Disabling User Login

I maintain one of the server in my office and that server is often being used as a hosting for some students's assignment (especially web-related assignment). Since each assignment has their own deadline, i have to limit the access for the students so that they couldn't update / upload any new files after the deadline.

So, i created a very simple bash script which uses passwd command to disable an account and set the time the script is to be executed by cron. Here's the simple script:
#!/bin/bash
/usr/bin/passwd username -l
let's say i name it lock.sh. All i need now is to set this script as executable and then add the time to crontab and it will be executed at the time defined.

Basically this command will add a character "!" to the shadow file so that user will not be able to login (because the password will be incorrect) and it's easy to solve my problem. If i need to reinstate that username again, i can just issue /usr/bin/passwd username -u and voila.... it will be able to login again.

Wednesday, February 16, 2011

Two More Emoticons Added

Two more hidden emoticons are being added into my Yahoo/Plurk Emoticons Script. They are Flower and Lantern Love. I think they are added to celebrate Valentine and Chinese Valentine Day Yahoo

Go get them!!!

Thursday, February 10, 2011

Updated Yahoo/Plurk Emoticons Script

I have updated my Yahoo/Plurk emoticons for Blogger scripts to add several new funny emoticons such as :
V TiffanyV ShyV LoveV PerfumeV Mail

I don't have any plan to add the ugly emoticons for now, so please don't ask me about adding it Wave OK

Thursday, January 06, 2011

Yahoo/Plurk Emoticons Updated

I have just uploaded a new version of Yahoo/Plurk Emoticons for Blogger script to my Box.Net account. It contains one more hidden emoticon which i think very funny. It's a dancing android logo Droid Dance. I wish there will be more dancing emoticons in the future Yahoo

Remember to install Greasemonkey extension first if you want to use this script on Blogger. Also note that this script is not yet working on new editor. You will have to use the old editor or else you won't see the emoticons on the Blogger Editor.

Monday, December 27, 2010

New Plurk Hidden Emoticons

Well well, it seems that there are more hidden emoticons after Christmas day. I have updated the Yahoo/Plurk emoticons for Blogger script to add 7 more Plurk emoticons and they are :

NodanceAngry OKTaser OKDance YarrBanana GymRussian EmotCode OK

More emoticons will be added whenever they are available. As usual, you can grab the latest code here and update your script on your browser.

Thursday, December 23, 2010

Blogger Emoticons Script Updated

I have updated my Yahoo/Plurk Emoticons for Blogger to add more Plurk hidden emoticons. In total, there are six new hidden emoticons. They are
Wave OKGym OKYarr OKMusic OKDance OKHungry OK

Grab the script at it's usual place in Box.net. Don't forget that this script requires Greasemonkey extension for Firefox and it will only work if you use the old editor in Blogger. It doesn't work in newer editor and i don't have plan to support the new one.

Monday, October 04, 2010

Fighting Plagiarism

Plagiarism is a heavy sin in education world. You can get a maximum penalty of being expelled if the staff found an evidence that you conduct this act. Many education places have created a string rules about it and it was used effectively for each assignment. I also have done the same thing for my class.

Detecting plagiarism is not an easy task as it would take a lot of efforts and time when you have so many students taking your class. For paper work, you can use Turnitin service which i think is the best plagiarism checker available for now. It's not free, but i think it's worthed, mostly if you ask for your students to create a journal which will be published.

For code plagiarism, this is even more interesting as source codes are available on the Internet and all you need is browse on search engines and you will get a bunch of codes. Stanford has created a system which can help us to detect software plagiarism called Moss (Measure Of Software Similarity) and i'm using it currently. It has been developed since 1994 and it has been updated constantly with new algorithm and mechanism.

Currently, Moss can detect this languages: C, C++, Java, C#, Python, Visual Basic, Javascript, FORTRAN, ML, Haskell, Lisp, Scheme, Pascal, Modula2, Ada, Perl, TCL, Matlab, VHDL, Verilog, Spice, MIPS assembly, a8086 assembly, a8086 assembly, MIPS assembly, HCL2.

If you want to find out about Moss, visit their website or see the background paper about this research. Moss is created by Alex Aiken Worship

* This is a scheduled post *

Thursday, September 23, 2010

Added One New Hidden Emoticon

I have just updated my Blogger/Plurk Emoticons script on my Box.net account to add one new hidden emoticon from Plurk. It will be added at the end of the emoticon lines. The new emoticon will look like this Yarr. It's like a pirate's captain.

Please note that this script will only work for older version of Blogger editor and it will not work in the current version as it has numerous of changes implemented by Blogger on the new version. So it's your decision to use the old one (which i think is still good enough) or switch to the new one, but you will not be able to use the script i made Goodluck

Saturday, July 03, 2010

Yahoo/Plurk Emoticons Updated

I have uploaded an updated version of my Yahoo/Plurk emoticons for Blogger on my shared Box.net account. Basically i only added some new hidden emoticons which were previously added to Plurk, which relates to World Cup 2010, like the famous colorful vuvuzela emoticons, goal emoticon, and also dance emoticon holding vuvuzela like this one Dance Vuvuzela

There are some hidden emoticons which are not included since the timing was not correct, since it's Christmas-related emoticons. So i will skip those and probably i will add it when Christmas is near. Below is the screenshot of the latest one on Blogspot editor (it will not work on newer editor, so please use the old one or you will miss this emoticons)

Instructions on how to use these script can be seen on my previous post which i wrote on 2009.

Sunday, March 08, 2009

Updated Emoticons For Blogger

In the past, i collected a javascript code to put YM's emoticons on Blogger. I modified the script to suit my need and now, i'm updating it with the new emoticons since YM 9 was released (including the new hidden emoticons).

To use the script, you must have Greasemonkey installed on your Firefox or Semonkey and then make a new script based on this. Activate Greasemonkey and go to Blogger. Go to writing tab and choose the Compose tab and voila..... there's your YM emoticons thumbs up

The problem with this script is that it doesn't use the real size. Every emoticons gets a similar size, so you will have to edit the image size manually. If you can hack the script and and add the size based on the real size, i would be happy to modify it happy

Update (9 March 2009: 1:03 AM): I have updated the script so that it will count the correct width based on the real size on Yahoo's server. Go get the script on this page. It will be expired in 30 days hurry up!

Saturday, April 12, 2008

Using -Rf Option in Linux Shell

Linux shells can be powerful, but it can also be deadly, if you are using it without caution. The second one just applied to me. I usually deletes files using * wildcard to make things easier, since i don't want to delete one by one. Sometimes, i used -f parameter to delete without haste, but today, i got a bad experience using -f.

At first, i wanted to delete a movie file that i have downloaded using rm -f blabla.part*, but i accidentally wrote it like this rm -f blabla.part1.rar *. You know what happened. All of my data in that directory is gone crying

The lucky thing is that i didn't use -Rf option. If that's the case, i'll be surely screaming loudly. Most of the data that were gone were movies (no big deal, since i can re-download them again) and also some pictures (well, i can make those avatars again in short time), so nothing important data is lost. Thank God praying

Small tips : Make sure the syntax you are writing is correct, mostly when you use -Rf option in Linux shell.

Friday, February 22, 2008

PHP Shell

I must say i'm impressed on this small utility (PHP Shell). It's a PHP scripts, but it a tool you can use to execute arbitrary shell-commands or browse the filesystem on your remote webserver. This replaces, to a degree, a normal telnet connection, and to a lesser degree a SSH connection.

It will shows a forms that can be used to login and execute several commands in your servers via your web server web interface.

Installation is very simple. All you need is unpack the package and place it on a directory where you can access it. Next thing is generate a randomize password using the password generator provided and put it on the configuration file and you are set to go.

It has some limitations though, for example not working when Safe Mode is ON, can't be used to run an application and it can't receive user input after it has been launched. So basically, you can do all administration stuff, but you can't run an application with this utility. Nevertheless, it's still a simple and useful scripts. Great job Martin big grin

Tuesday, January 08, 2008

BBAntiSpam Effectiveness

After i installed BBAntiSpam, the amount of spammer in Indonesian Linux Forum has decreased a lot. This is a proof that BBAntiSpam is very effective for fighting spammers (at least for now).

The only thing you should consider is updating the questions regularly. Since it's based on random questions, there's a chance that spammer who had modified it's spam scripts could answer the questions provided by BBAntiSpam. Adding questions in BBAntiSpam is very easy, since it's array-based, so you can see the pattern on the configuration file.

I will see for the next few weeks and if there's no leakage, i'm considering to change the registration method again to email, so that users who has just registered can activate their account and directly use the forum without waiting for my approval.

Sunday, January 06, 2008

BBAntiSpam

I missed one spammer today on Indonesian Linux Forum and it posted porn messages across the forum and i was quite late noticing it, since i just came online tonight, but i managed to remove all of it's post and delete it's username to prevent further action.

Budi from Baliwae told me a nice Anti Spam tool which can be used for phpBB and other forums. It's called bbAntiSpam. It's very easy to use and customizable. The installation procedure is very easy. All you need is just upload the files to the server and add one line in one of the file to include those files and it will start working at that time. For phpBB, you can look on this forum, meanwhile, for WordPress, you can find it here. There are a lot more.

The script is free, but it's limited in it's feature. If you want further customization, you will have to buy the license.