Wednesday, November 05, 2014

CURL Reboot D-Link Router (DWR-921)

/usr/bin/curl '' -H 'Host:' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:33.0) Gecko/20100101 Firefox/33.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Referer:' -H 'Cookie: ID=AMIT0000' -H 'Connection: keep-alive'
/bin/sleep 1
/usr/bin/curl '' -H 'Host:' -H 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:33.0) Gecko/20100101 Firefox/33.0' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' -H 'Accept-Encoding: gzip, deflate' -H 'Referer:' -H 'Cookie: ID=AMIT0000' -H 'Connection: keep-alive'

Wednesday, May 28, 2014

Controlling Mitsubishi A/C with iTach IP2IR

 - iTach IP2IR with IR blaster
 - Android 4 (rooted)

Mitsubishi Msz-fd50va & Msz-fd35va indoor units IR command codes:
 ON = sendir,1:3,1,38109,1,1,131,65,17,49,17,49,16,17,16,17,17,16,16,49,16,17,16,17,16,50,17,49,16,17,16,49,16,17,16,17,16,50,16,49,16,17,16,49,17,49,17,16,17,16,17,49,17,16,16,17,16,50,16,17,16,17,16,17,17,16,16,17,17,16,16,17,16,17,16,17,16,17,17,16,17,16,16,17,17,17,16,17,17,16,17,16,16,17,17,16,16,17,16,50,16,17,17,16,17,16,16,17,17,16,16,50,17,16,17,16,17,16,16,17,16,50,16,50,16,17,16,17,16,17,17,16,17,16,17,16,17,16,16,17,16,17,16,17,16,50,16,50,16,17,16,17,16,17,17,16,16,17,16,17,16,17,17,49,17,49,16,17,16,17,16,49,17,49,16,50,17,16,16,17,17,16,16,50,16,17,16,17,17,16,17,16,17,16,17,16,16,17,17,16,17,16,16,17,17,16,16,17,17,16,17,16,16,17,16,17,17,16,16,17,16,17,16,17,16,17,16,17,17,16,16,17,16,17,16,17,17,16,16,17,16,50,16,17,17,16,16,17,16,17,16,17,17,16,17,16,17,16,17,17,16,17,17,16,17,16,16,17,17,16,16,17,17,16,17,16,16,17,16,17,17,16,16,50,16,50,17,49,16,17,17,49,16,50,16,17,17,653,134,66,16,50,16,50,17,16,16,17,16,17,17,49,17,16,16,17,16,50,16,49,17,16,16,50,17,16,16,17,16,49,16,50,16,17,17,49,17,49,16,17,16,17,17,49,16,17,17,16,17,49,16,17,16,17,16,17,16,17,17,16,17,16,16,17,16,17,16,17,17,16,16,17,16,17,16,17,17,16,17,16,16,17,16,17,16,17,17,16,16,17,17,49,16,17,16,17,16,17,16,17,16,17,16,50,16,17,17,16,16,17,16,17,17,49,16,50,17,16,16,17,16,17,17,16,17,16,16,17,16,17,17,16,16,17,16,17,17,49,16,50,17,16,16,17,16,17,16,17,16,17,16,17,16,17,16,50,17,49,16,17,16,17,16,50,16,50,16,49,16,17,16,17,16,17,16,50,17,16,16,17,17,16,17,16,16,17,17,16,16,17,16,17,16,17,17,16,17,16,16,17,16,17,17,16,16,17
OFF = sendir,1:3,1,38109,1,1,131,65,16,50,16,50,17,16,16,17,16,17,17,49,17,16,16,17,17,49,17,49,17,16,16,50,16,17,17,16,16,50,17,49,16,17,16,50,16,50,17,16,17,16,16,50,17,16,16,17,16,50,16,17,16,17,17,16,17,16,17,16,16,17,16,17,16,17,16,17,16,17,17,16,17,16,16,17,17,16,16,17,16,17,17,16,17,16,16,17,17,16,17,16,17,16,17,16,16,17,16,17,16,17,16,50,16,17,16,17,17,16,17,16,16,50,17,49,17,16,17,16,16,17,17,16,17,16,16,17,17,16,17,16,16,17,17,16,16,50,16,50,16,17,17,16,17,16,17,16,17,16,16,17,16,17,16,50,17,49,17,16,17,16,16,50,17,49,16,50,17,16,16,17,16,17,17,49,16,17,16,17,17,16,17,16,17,16,16,17,16,17,17,16,16,17,16,17,17,16,17,16,16,17,17,16,17,16,16,17,16,17,17,16,16,17,16,17,16,17,17,16,17,16,17,16,17,16,16,17,16,17,17,16,16,50,16,17,17,16,16,17,16,17,17,16,17,16,16,17,16,17,17,16,16,17,17,16,16,17,17,16,16,17,17,16,17,16,16,17,17,16,17,16,17,16,17,49,16,50,17,49,17,16,17,16,17,49,17,16,17,649,135,65,17,49,16,50,17,16,16,17,17,16,16,50,17,16,16,17,17,49,16,50,17,16,16,50,16,17,17,16,16,50,17,49,17,16,17,49,16,50,16,17,17,16,17,49,16,17,16,17,16,50,17,16,17,16,16,17,17,16,16,17,16,17,16,17,17,16,16,17,17,16,17,16,17,16,17,16,16,17,16,17,16,17,17,16,16,17,16,17,16,17,16,17,16,17,16,17,17,16,17,16,17,16,17,49,17,16,16,17,17,16,17,16,16,50,16,50,17,16,16,17,16,17,16,17,17,16,17,16,16,17,17,16,17,16,16,17,16,50,16,50,16,17,16,17,16,17,16,17,17,16,16,17,16,17,16,50,16,50,16,17,17,16,17,49,17,49,17,49,17,16,16,17,16,17,17,49,16,17,17,16,17,16,17,16,17,16,17,16,16,17,17,16,16,17,17,16,16,17,16,17,17,16,16,17,17,16

Note: code have been retrieved using Telnet and get_IRL command not with the iLearn software, it can't record such a long code, see more details here ->

Then I created a script in Perl to send my command over Telnet.

Perl is handy because it is installed in a lot of Linux distribs (readynas) by default. So you can then run some cron jobs that call this script in order to schedule the power on and off of the A/C units.

Well... Perl is not present by default on Android... but can be done using the followings.
 - SL4A with Perl for Android

You need to change he first line of the perl script to:

#!/data/data/com.googlecode.perlforandroid/files/perl/perl -w

Others handy Android software:
- SManager -> to create terminal widgets that calls the Perl script

Friday, November 08, 2013

PhProjekt broken left side menu

If you have a broken/empty menu with the projects tree on the left side and you're using Firefox>24 or Chrome>29, like this:

 that's because Dojo 1.6 has a bug that is fixed on this release here:

Just copy the files over in phprojekt/htdocs/ and that will fix it.

But then you'll notice that it takes forever to load all the .js files, so you'll need to create a custom build, see here:

I used this:

dependencies ={

  layers:  [
      name: "mydojo.js",
      dependencies: [

  prefixes: [
      [ "dijit", "../dijit" ],
      [ "dojox", "../dojox" ]


Friday, August 09, 2013

Yes, Ethernet Cable Pin Out IS Important

... maybe it sounds straightforward but the Cable Pin Out needs to be respected if you want to acheive 1Gbps speed with Cat 5E or Cat6 cables. If you don't respect it you'll be stuck to 100Mbps.

It seems like the position of each cable within the twists makes a big differences? Especially the blue cable which is put on the 5th position.

Anyway, more information about the Pin Out here:

or here is the diagram:

Saturday, May 26, 2012

Cisco Default IP (

I've just received a Cisco router 1921.
Opened the box and check for a manual or a CD that would explain what to do configure it, but nothing. As the online documentation from Cisco must be somewhere I've not been looking yet, I had no idea what to do with this box.
I figured it out by connecting my computer to the console port. Using ZTerm for OS X with the following settings:

Bits per sec    :  9600 
Data bits       :     8 
Parity          :  none 
Stop bits       :     1 
Flow control    :  none  

Default user/pass is cisco/cisco
Then pay attention to the procedure to change the password on the welcome message.

So after listing the configuration looks like the default IP for port 0/0 is not anymore as some website suggest, but

So you can directly telnet it to this address, or even use the web admin (if you have Java...).

Tuesday, February 28, 2012

Build OpenWRT on WR1043ND from SVN

1)Install necessary packages (osx)
$port install macports packages:
$port install coreutils asciidoc binutils bzip2 fastjar flex getopt gtk2 intltool jikes zlib openssl p5-extutils-makemaker python26 rsync ruby sdcc unzip gettext libxslt bison gawk autoconf wget gmake ncurse
$port install e2fsprogs ossp-uuid
$port install findutils

2)Create Work Image (osx)
open Disk Utility in the /Applications/Utilities directory.
Click File -> New -> Blank Disk Image...
Name = OpenWRT
Choose a size = 4.5GB.
In Format drop down, select Mac OS Extended (case-sensitive)
Image Format= sparse disk image
it will mount it on /Volumes/OpenWRT

3)get last sources
$cd /Volumes/OpenWRT
$svn co svn://

4)Make configuration and compile

$make menuconfig

choose Target System Atheros AR7xxx/AR9xxx
choose Target Profile (TP-LINK TL-WR1043N/ND)

$make -j 3

after approx. 45mn on a core 2 duo

5)Flash router
$cd ~/openwrt/trunk/bin

locate image
openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-factory.bin (for first time flash, IMPORTANT: note tested)
openwrt-ar71xx-generic-tl-wr1043nd-v1-squashfs-sysupgrade.bin (for OpenWrt Upgrade)

flash using web interface, wait for 5mn

6)Configure router

There might be quite a lot of missing packages, you need to install manually.

connect internet cable on WAN port
#opkg update
#opkg install l2tpv3tun
#opkg install luci
#mv /etc/config/luci-opkg /etc/config/luci
#/etc/init.d/uhttpd enable
#/etc/init.d/uhttpd start

opkg install perl
opkg install perlbase-base
opkg install perlbase-essential
opkg install perlbase-autoloader
opkg install perlbase-config
opkg install perlbase-config
opkg install perlbase-getopt

opkg install openswan

Here you are, you now have a fully l2tpv3tun enabled, web interfaced, gigabit Ethernet router!

L2TPV3 commands

#l2tpv3tun show tunnel
#l2tpv3tun show session

Further readings on playing with l2tpv3: (Linux specific)

Useful commands:
If you can't ping the router anymore, after reset, press QSS on reboot when sys is blinking (it will blink faster), then you can $telnet
then type
#mtd -r erase rootfs_data
this flush everything back to default (and auto reboot)

Restart the network services:
#/etc/init.d/network restart

Verify syntax on /etc/config/network config (IMPORTANT if you don't want to reboot with a wrong config that will force you to use the commands below):
#uci show network

Query a specific interface status:
#uci -P/var/state show network.wan

And last but not least, how to stop vi from stupidly indenting your PASTE:
:set noai

Labels: , , ,

Thursday, March 17, 2011

How to really disable spotlight and save your old mac

I have one of the first generation of Mac Book Intel. This machine has been working really good for the past five years.
Since I bought it I've been steadily upgrading it with more RAM and faster and bigger hard-disk.
With the last hard-disk, I was happy to have all my 500Go desktop files with me, everywhere I go.
But with Snow Leopard and a bigger hard-disk came the problem of the dreadful mds process. It was just dragging my 1.8 MHz duo core to its knees; until the whole laptop overheat till reboot.
So I figured out it was related to spotlight which I never used (I much prefer the unix commands to do complicated searches).
And suddenly came Snow Leopard 10.6.6. which made removing spotlight much harder...

So if you have a old mac laptop you don't want to trash with a lot of files and you don't know what is spotlight, this is what you should do:

1 - enable the superuser (root) account (by doing this)

2 - start a unix terminal Applications>Utilities>Terminal

3 - verify the mds process is the reason why your computer is overheating by typing
top -o cpu

into the Terminal. If it shows 100% and stay like this for too long (5-30mn) it means this process should be disabled

4 - create a script that turns spotlight indexing off
mdutil -a -i off

5 - run this script ( as root
login root
(type your password)
chmod 755
chown root
mv /usr/bin/

should be enough (Terminal prompting "Indexing disabled.") if you run osx prior to 10.6.6. But on 10.6.6 mds is like a phoenix always coming back even after you ask the system to uninstall it. So I added a daemon that just kill it every minutes. To do so:

6 - add a launchd plist in /Library/LaunchDaemons/. Call this file com.devdaily.nomds.plist

and copy/paste the following text into it

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">







Now reboot, or if you don't want to reboot run
launchctl load /Library/LaunchDaemons/com.devdaily.nomds.plist

You should never be bothered by splotlight anymore.

I know it sounds a bit brutal to force the system like this, there might be a way to do the indexation good once and for all, or disable it gently, but as I said above I don't use any of this features, so this was the fastest and most acceptable solution I came with.

If you know what you're doing you can use this technique for a lot of other annoying processes, like all those from Adobe, but this is another matter.

Labels: , , , , , ,

This page is powered by Blogger. Isn't yours?