Posts

Showing posts with the label non-java

A Simple webserver on your Mac to access your files remotely from Windows

Open a terminal window and run following commands : $ cd /Documents/yourSharedFiles $ python -m SimpleHTTPServer 8080 Serving HTTP on 0.0.0.0 port 8000 ... That's it!!! Your web server is started.  On the browser, type following address to access your files remotely. http://localhost:8080 The contents of your current directory must be shown on the browser now. Advanced issues & troubleshooting: 8080 is the port number. If you get " socket.error: [Errno 48] Address already in use" , change the port number to another one. (less than 65536) If you want to make your webserver run in port 80 , launch the command above with sudo and enter your root password : $ python -m SimpleHTTPServer 80 Password: Serving HTTP on 0.0.0.0 port 80 ... in this case the url will be : http://localhost Make sure to shut the webserver down when you are done with cmd-c key or just closing the terminal window.

Connect via SSH without a password from MacOS to Linux with an SSHKEY

Don't panic , it is really easy. Your Steps will be: 1. Create a key on your Mac 2. Define your key on remote Linux 3. Connect via ssh. 1.  Create the key on your Mac Open the terminal :) First make a directory named .ssh on your home directory ( mkdir .ssh ) If it exist , no problem. Go to the newly created .ssh directory with command cd .ssh Then, you need to create a ssh key on your MAC. There will be 2 files for key. If you dont want any passwords , just press enter when passphrase asked. Filename will be default id_rsa if you just hit enter. But if it already exists , you may want to choose another name. Hakos-MacBook-Pro:.ssh hakan$ ssh-keygen -t rsa -C "your@email.com" Generating public/private rsa key pair. Enter file in which to save the key (/Users/hako/.ssh/id_rsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /Users/hako/.ssh/id_rsa. Your public key has been saved in /...

Schedule windows to close a program

On windows If we need to close a program (maybe a java) at a certain time , use this command : at 13:29 taskkill /F /IM 6976 6976 is the process id (you can find it on task manager - processes tab. If not seen , than on the top menu choose View-Select Coloumns and mark PID (processID) ) to cancel all scheduled commands at /delete you need to open cmd window as administrator to run at command. (startMenu-accessories right click on command window and choose "run as admin" hop this helps.

How to measure distance on google maps ?

Use the page here , you just click on points and the distance will appear either in miles or in kilometers. You can also mark multiple points and calculate a real length of a path.

Redirect StdErr to Stdin in Batch and Shell Scripts

On windows command prompt : mybatch.bat 1> log.txt 2>&1 This redirects stdin to log.txt and stderr to stdin On Bash Linux Shell: grep * &> allout.txt

Google Chrome Ready For Download

Google has released a new browser named Google Chrome. This browser is expected to become most widespred computer program ever written. Google Chrome will set the standarts for Web2.0 and Web3.0 technologies. Chrome is a ligtweight browser and does not consume your CPU and memory and it makes Chrome fast and reliable. Download Here Here is a gread comic book for chrome on googlebooks site At first impression Google Chrome is not working properly with PHP-Admin !!!

Console Beep On Error Line of a Log File

Ok folks , this is non-java :) Today I had to watch a log file and alert some ppl when an error phrase seen on log file. This is a terrible jıb todo. First I run on my linux server: #tail -f mylogfile | grep ERRORSTRING this worked but put me in front of the screen. Why not my console beep when ERRORSTRING exists in the log file ? I need an application to beep when read a line from stdin. This is piece of cake in java but i did not want to load JVM for this purpose because of memory needs. So I warped to good old days and decided to write a C program to do this job. #include <stdio.h> #include <string.h> #include <stdlib.h> int main(int argc, char *argv[]) { char buf[1024]; int n; while (fgets(buf, sizeof buf, stdin) != NULL) { n = strlen(buf); if (n > 0 && buf[n-1] == '\n') { printf("\a"); printf("%s\n", buf); ...