Saturday, May 25, 2013

Max image upload limit in wordpress

I tried hosting a web server on a virtual machine,
Details:
Virtual box
Ubuntu 12.10 server
apache
wordpress

I tried to upload a couple of images from a trip with my family, but there was a file size limit of 2MB on each image.

Solution:


1.find the file php.ini in your php installation:
find / -iname “php.ini” -print 2>/dev/null

(The “-print 2>/dev/null” part makes sure you don’t see error massages in the find output)


I found my files in two places:
/etc/php5/apache2/php.ini
/etc/php5/cli/php.ini


2. Edit each file using:
sudo vim php.ini
 

3. And search for the line:

upload_max_filesize = 2M
in vim:
/max_filesize

4. Change it to your preferred limit, save the file.

5. Restart apache with
sudo service apache2 reload 





Can’t console to router on ngs3

Running ngs3 on linux, configured everything, chose a bin file for a router, dragged him to the window, and now I am trying to console into him from right mouse menu, but can't.

Solution:
From settings, enter terminal settings, and chose another terminal console app, hit use, and apply.

Thursday, May 23, 2013

My Scripts: Backup your configuration files


File name: configbackup

#!/bin/bash

tmpdate=$(date +%D | sed "s/\//-/g");


tar zcvf ~/config_backup$tmpdate.tar.gz ~/.vimrc ~/.zshrc ~/.config/awesome/rc.lua  ~/.vimperatorrc /usr/local/sbin/*



Explanation:

Save the date as 05-23-2013 for example, the sed is substituting the the '/' in date with '-'.
tmpdate=$(date +%D | sed "s/\//-/g"); 


Create a compressed tar archive in home dir, called config_backup05-23-2013, where the date in the name changes acording to the date when you executed the scrip.

The files to be included are some configuration files which are important to me, but you should change them to your preferred ones, just write all of them with space between each one, all on the same line.
tar zcvf ~/config_backup$tmpdate.tar.gz ~/.vimrc ~/.zshrc ~/.config/awesome/rc.lua  ~/.vimperatorrc /usr/local/sbin/*








I save all my scripts in /usr/local/sbin/, which is included in $PATH, that way I can
launch them just by issuing their name from every directory.

I chose this dir because it was empty to begin with, a perfect place for all my scripts.


This is part one of a four part mini series where I will post small scripts I've written, along some documentation and explanation.

Saturday, March 2, 2013

Sleep as android

Yesterday was my first trial of the app called "sleep as android".
Sleep as android is an alarm clock app which can also monitor your sleep.
It does it using the phones gyroscope, you lay your phone on you bed next to you, and during the night, whenever you move, the phones sensors pick it up, judging by the amount of movement, it knows whether you are in a light sleep or deep sleep stage.

My two graphs so far:


I am planning on using it for another week, and if I like it, buy the full version.

One possible experiment I may conduct is to see the effects of meditation before bed on the quality of my sleep.

I could also see if I avoid computer screen light before bed, it improves my sleep.

Wednesday, May 23, 2012

Martial art training with an audio guide

This September I started training in the martial arts, in a discipline called Ryukyu Kenpo Kobujutsu Kai, 
or in short: Ryukyu Kenpo.
http://ryukyu-kenpo.com/
I got my 3rd belt this month: yellow.
One of the ways to progress quickly in martial arts, is to train at home. at the off hours of the dojo.
But I wanted to create a new way to train, so that I will remember all techniques much better.
I wanted some one to tell my a name of a random technique. And I would have to perform it.


But I have no partner to train with, so I decided to create a project:
The goal: To create multiple audio files, each one is saying the name of one technique, with a delay to allow performing it, and than have those files on an ipod, and using the random option, I will be able to train.


The process:
Step 1:
Go to the ryukyu kenpo site. and save all techniques to a txt file.

Step 2:
Remove description of all techniques, leaving only the names.
I did this quickly using a vim macro.
Step 3:
Split the file to many files, each containing one technique.
I used the command:
split -l 1 Martial_arts_techniques.txt
-l 1 - meaning to split the file by single lines


This gave me a lot of files named:
xaa, xab ... xcj

Step 4:
Created a wav file of silence using Audacity

Step 5:


In the folder with multiple text files (xaa,xab...), I entered:
ls -l > filelist.txt
To create a file with the names of all the files, each one in it's own line

Step 6:
I wrote this bash program:


1 #!/bin/bash

2 cat ~/Desktop/filelist.txt| while read line;
3 do name=$(echo $line | cut -c58-70) ;espeak -f $name -w $name".wav"  ; 
4 done

Program explanation:
Line 2: Pump the filelist file to a loop, each iteration, the current technique name is stored in line.
Line 3:Cutting from:
-rw-rw-r-- 1 pentagonpie pentagonpie      32 2012-05-22 12:24 xcc
(The result of the 'ls -l')
only the last part:
xcc 

Then using espeak, converting the text file into an audio file.



saving as program.bash.
Executing using 
bash program.bash
To create a folder with all the text files mixed with the new .wav files

Step 7:
Deleting all txt files:
rm *.txt 

Step 8:
Creating a program similar to the previous.

1 #!/bin/bash

2 cat ~/Desktop/filelist.txt| while read line;
3 do name=$(echo $line | cut -c58-70) ;sox -m $name".wav" final_silence.wav $name"2.wav"  ;
4 done


Line 3: using sox to combine every file with the silence file from step 4.

Step 9:
Importing all audio files to ipod, and using portable speakers.

That is how I done it!

Sample file:


Monday, May 14, 2012

Tracking my push-ups

I am trying to increase the number of pushups I can preform.
A great site dedicated to this effort is calld http://hundredpushups.com/

Being a scientific oriented guy, and a geek, I wanted to track my progress.
I decided to use a great site for this documentation:

http://daytum.com/
"DAYTUM HELPS YOU COLLECT,CATEGORIZE AND COMMUNICATEYOUR EVERYDAY DATA."




DAYTUM main page
So I created a new category called "Exercise", added a new item called "pushups", and inserted 16 and 17 as my first attempts.
But I couldn't find an option to show me a trend chart, the closest I could get was a lousy filled graph which didn't tell me much.

So I decided a to use a different site.
I opened a new form in google docs, with only one text box, the amount of pushups I did.


Now each time I perform a set of push-ups, i enter this site which i bookmarked, and insert the new number.

behind the scenes is a spreadsheet which gets updated automatically with the new information.

I created a new trend chart, but I wanted my chart to update with each new entry,
so in the range, I changed it from 
"Sheet1!A2:B3" to "Sheet1!A2:B20"

It basically tells the chart to create a chart from my existing data, AND from additional colums which are blank at the moment.
The chart algorithm is smart enough to exclude the non-existing data, and when new data is added, it will be added to the chart. 


And this is exactly what I wanted!

Sunday, May 13, 2012

First!!!

As I was sending requests to my brain, to come up with an interesting topic for my first blog post, I decided to name it "First!!!".

Seems appropriate to use the famous "first" internet meme for your first post.
When you are using the web (surfing?), many jokes you will encounter will be inside jokes of the web.

So, in order to enhance your browsing experience, you should familiarize yourself with some of them,
Here is a nice guide:
link