... actually ... my first one that was approved by Apple and got published on the AppStore. Check it out here: DomainTyper iPhone Application
i wanted to turn off the deep sleep in mac-os. Here is the script that solves this:
sudo sh -c '
pmset -a hibernatemode 0;
nvram use-nvramrc?=false;
rm /var/vm/sleepimage > /dev/null 2>&1
'
Recently I've purchased an iPhone 3G - and despite of all my previous prejudices i have to say that this phone is really good. Actually it's a UNIX based computer with 128MB ram and a 620MHz ARM 1176 cpu underclocked to 412MHz - probably because of stability and power consumption.
We can say that 10 years ago a computer with these characteristics was a supercomputer which sat on your desk and weighted like 10kilos - but now it just lies in my pocket :) ... cool...
So I've decided to find out what it takes to write a simple hello world application for it - but it turned out that i just digged deeper myself into the iPhone development world. (Currently in my free time I'm writing a complex rss reader ...)
Here are the steps required to start developing for iPhone:
1. Download the iPhone SDK. This will lead to step 2 ...
2. Register at http://developer.apple.com/iphone and download the SDK :) - strange enough ... you may download the SDK only if you register on the site .. whatever :) ... i did it.
3. Look at the hardware & software requirements and aknowledge that there is no microsoft windows support for this (which actually makes sence, probably there is no apple tool for developing for windows mobile either ...). So you should... BUY A MAC. I've bought an older mac mini - it has a 1.5GHz intel cpu and 2G Ram - the developer environment runs absolutely fine on it.
It looks like this:

4. After you own a mac - you can start developing in Objective-C and test your applications in the iPhone Simulator. cool :) - but you soon will realise that you can not test your application on the actual iPhone device. Why ? Because you have to pay 99$ to Apple for a code signing certificate as iPhone only accepts programs signed by certificates issued by Apple. After this you can upload your application to your iPhone - (unless of course you jailbreak your phone...)
So these are the preliminary steps required to start iPhone developing ... I will explain the 'Hello World' steps in my next post ;)
To follow up on getting bluetooth to work on Ubuntu Hardy, I did this:
1) visit this site, and add the Debian sid repository
Unofficial Debian packages
it is not necessary to add the source repository.
1a) refresh synaptic, and add the package
omnibook-source
2) use module-assistant to build the kernel module
(but first, exit synaptic)
sudo m-a a-i omnibook-source
(you have to work out how to get module-assistant working
yourself. It is a package; you can find it in Synaptic.
Make sure you install all recommended dependencies.
Try installing build-essential as well)
3) we need to make sure the module loads at startup
so edit the file /etc/modules
sudo vi /etc/modules
and add the line
omnibook
at the end
4) and we need to get it working so make a file called
omnibook in /etc/modprobe.d
and in this file put one line
omnibook ectype=14
5) you don't need to reboot. You can do this
sudo modprobe omnibook ectype=14
by doing this, the bluetooth icon appears.
I just synced my phone. It works very well.
Source: http://www.linuxforums.org/forum/ubuntu-help/125492-solved-problem-bluetooth.html
These days I've bought a software, AllwaySync (http://allwaysync.com/) to easily synchronize my laptop's data to my central NAS device at home. It is a really handy piece of software but it is a big pain in the ass to allways manually start the synchronization - so I've figured out how to schedule a task in Windows Vista on the event of connection my laptop to a specific WiFi network.
So here are the rough steps you need to do. Start event viewer and go to the Microsoft-Windows-WLAN-AutoConfig/Operational log and check for the events with the ID 8001. These events are logged when the WiFi connection is up & running - and it contains all the information on the WiFi network. Here is how it looks like:
WLAN AutoConfig service has successfully connected to a wireless network.
Network Adapter: Intel(R) Wireless WiFi Link 4965AGN
Interface GUID: {40a3c36f-e20e-4875-b4be-db61787a5fe3}
Connection Mode: Connection to a secure network without a profile
Profile Name: ExternalDevices
SSID: ExternalDevices
BSS Type: Infrastructure
BSSID: 00:1C:57:43:14:11
PHY Type: 802.11g
Authentication: WPA-Personal
Encryption: TKIP
802.1x Enabled: No
Now the nice thing about the new event viewer is that it can give you an XML representation as well of this event:
| XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
<Provider Name="Microsoft-Windows-WLAN-AutoConfig"
Guid="{9580d7dd-0379-4658-9870-d5be7d52d6de}" />
<EventID>8001</EventID>
<Version>0</Version>
<Level>4</Level>
<Task>0</Task>
<Opcode>0</Opcode>
<Keywords>0x8000000000000000</Keywords>
<TimeCreated SystemTime="2008-09-03T08:13:56.216Z" />
<EventRecordID>6497</EventRecordID>
<Correlation />
<Execution ProcessID="12" ThreadID="14812" />
<Channel>Microsoft-Windows-WLAN-AutoConfig/Operational</Channel>
<Computer>sparky</Computer>
<Security UserID="S-1-5-18" />
</System>
- <EventData>
<Data Name="InterfaceGuid">{40A3C36F-E20E-4875-B4BE-DB61787A5FE3}</Data>
<Data Name="InterfaceDescription">Intel(R) Wireless WiFi Link 4965AGN</Data>
<Data Name="ConnectionMode">Connection to a secure network without a profile</Data>
<Data Name="ProfileName">ExternalDevices</Data>
<Data Name="SSID">ExternalDevices</Data>
<Data Name="BSSType">Infrastructure</Data>
<Data Name="BSSID">00:1C:57:43:14:11</Data>
<Data Name="PHYType">802.11g</Data>
<Data Name="AuthenticationAlgorithm">WPA-Personal</Data>
<Data Name="CipherAlgorithm">TKIP</Data>
<Data Name="OnexEnabled">0</Data>
<Data Name="ConnectionId">0xe</Data>
</EventData>
</Event>
|
So you need to fire up Task Scheduler, create a new task, and in the triggers you should choose to run this task on a new event and use an XPath that matches the event that is logged. Here it is my version of the XPath that matches the event with ID 8001 and the Wifi network with the name: 'hostingabc.hu':
| XML |
1
2
3
4
5
6
7
8
9
|
<QueryList>
<Query Id="0"
Path="Microsoft-Windows-WLAN-AutoConfig/Operational">
<Select Path="Microsoft-Windows-WLAN-AutoConfig/Operational">
*{System\{(EventID=8001)}} and
*{EventData{Data{@Name="SSID"}='hostingabc.hu'}}</Select>
</Query>
</QueryList>
|
Note: I have a bug in my colorer and it does not handle the square bracket characters so I've replaced them with curly braces :) - just be sure you replace them to the proper square brackets.
Enjoy :).
http://www.wl500g.info/showthread.php?t=15575
Since the existing automounter supports only hard disks to be mounted - i needed a solution for automatically mounting cd filesystems.
So the solution is to cross compile automount and to include autofs4 & /proc support into the kernel.
If you want to try it follow these steps:
0. download these files: http://www.moszi.net/dev/automount/automount.tar.gz
1. insmod autofs4.o
2. ln -s /proc/mounts /etc/mtab (this will only work if you recompiled your kernel with /proc support)
3. copy the necessary files to their places
4. edit your /opt/etc/auto.misc file
5. start /opt/etc/init/S97autofs
Enjoy
When I bought this router I really did not realize that it will open a whole new world to me ...
For a long time I wanted a NAS (Network Attached Storage) device so I can keep my files in a centralized way, but the price of these devices always was so high that it kept me away from buying one ...
So when I've found out that this router has 2 USB ports and that a custom firmware can be installed on it to support additional services I decided immediately that I'll buy one of these small wonders :) ... On the very first day I've installed Oleg's custom firmware and started digging into the firmware. It comes with a balanced set of features, it has telnet, ssh, ftp, samba, and other goodies that you might need. So it was perfect.
However over the years the loss of several hard disks - which obviously resulted in quite a few times loosing my precious data - convinced me that I simply need a RAID set to protect my data.
As the custom firmware does not support RAID sets I downloaded Oleg's sources for the firmware and rebuilt it adding a few other things that i found necessary ;)
This way i have:
* RAID1 support in the router (and have 2 hard disks linked in one array)
* CD/DVD support
* automount support
* wtmp support (to have historical track of logins)
Other stuff on the router:
* there is a cool script which periodically checks for brute force attacks and denies the source IP of accessing the router anymore.
* there is a torrent client with web based UI
* lighttp with php support can be installed on it, and can be used to stream all your music (using with Winamp + Bento skin's browser works like a charm!)
* there is mini-sendmail to send notifications to yourself anywhere you are ..
Hardware 'upgrades':
I've opened the box and installed a card reading into it and plugged a 4GByte microdrive so I will have a persistent 'hard disk' in the router - and in the next couple of days I will install 128MB of memory (instead of having only 32M ...). { I will keep you posted about this ;) }
Bottomline: if you need a stable and really good router, by this one.
http://wl500g.info/showthread.php?t=15550
Hi Everybody,
I'm using Oleg's 1.9.2.7-10 firmware for 3 months now (on a WL500gp) - thanks Oleg - and it is really great, it works just perfectly !
Since I do not have a desktop PC at my home - I only use a notebook - I really wanted to create a redundant way for storage and because I'm using Xbox for media playing I wanted an external DVD reader to be attached to my router so I can access all my DVD's through samba from my xbox.
To achieve this I recompiled Oleg's firmware to include SCSI emulation for IDE/ATAPI CDROM & to include RAID support in the kernel. If you don't want to recompile the kernel yourself these are the steps to achieve both functionalities:
CD-ROM:
1. insmod cdrom.o
2. insmod isofs.o
3. insmod sr_mod.o
(it might be that the order is not this one, I'm writing this from my head)
at this time your cd device will appear under /dev/scsi/...
RAID1:
1. insmod md.o
2. insmod raid1.o
after this you can create your RAID1 soft array using mdadm. LVM is not needed.
Note1: Because the 2.4 kernel contains a bug in md.c you need to replace this file with the correct one (this is described here: http://wl500g.info/showthread.php?p=100925 and it works perfectly when you recompile the kernel)
If you need help with this, just contact me.
PS. (offtopic) I've a USB hub with 6 USB ports attached to one of the USB ports on the router. This has 2 hard disks linked in a RAID1 array + the DVD reader. This works as intended - no special drivers were needed to support this.
The second USB port on the router has attached a 6 in 1 card reader with a 4GByte CF Microdrive. This works as a charm as well
http://wl500g.info/showthread.php?t=15552
These days I've spent some time figuring out the structure of the firmware sources - here are my finding on how to recompile it:
1. Since I use Vista, I downloaded an Ubuntu image for vmware player - i did all the firmware compilation in this virtual machine
2. downloaded the asus firmware, oleg's firmware additions and the uclibc toolchain. these are the items you need to recompile the firmware.
3. I've made a nice script that uncompresses all these packages, applies Oleg's patches on the firmware, and applies some additional minor changes to the source tree.
You can download this package from this location: http://www.moszi.net/dev/download/wl500g-source.tar.gz
The script you should run is : createBaseFirmwareSources from the binaries folder. (cd to this folder, otherwise it will not run correctly)
Also please note, that my own patches are located in the patches folder. Currently only 3 minor changes:
1. correcting the raid1 CRC bug (md.c)
2. wide character support in uClibc
3. Makefile for oleg's patches in order to allow wtmp usage in dropbear (i didn't succeed with this one yet)
Have fun, if you need help, contact me.
These days I was playing around with powershell - and it proved itself quite useful. I already have several backup scripts, defragment & anti-virus check script on my server. So on top of all this coolness :) this is very cool indeed as well:
| XML |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
<html>
<body>
<table>
<tr><td>ID</td></tr>
<% get-process | foreach { %>
<tr>
<td><%=$_.ID%></td>
<td><%=$_.ProcessName%></td>
</tr>
<% } %>
</table>
</body>
</html>
|
Take a look at this link: http://blogs.msdn.com/powershell/archive/2008/07/18/powershell-asp-too-cool.aspx
If you've ever wondered how could you list all your usernames and passwords that are set on the 'Directory Security' tab on each website's properties (in inetmgr) then this small C# code snippet would be for you ..
Just a note: so far it seems that this code snippet works only on Windows Server 2003 - i have no ideea why doesn't it work on XP / Vista as well (don't care actually :) - i needed it for win 2003)...
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
static void Main(string{} args)
{
DirectoryEntry iisBase = new DirectoryEntry("IIS://localhost/W3SVC");
PrintUserNameAndPass(iisBase);
}
private static void PrintUserNameAndPass(DirectoryEntry iisChild)
{
String userName = null;
String password = null;
if (iisChild.Properties{"AnonymousUserName"} != null)
{
userName = iisChild.Properties{"AnonymousUserName"}.Value as String;
}
if (iisChild.Properties{"AnonymousUserPass"} != null)
{
password = iisChild.Properties{"AnonymousUserPass"}.Value as String;
}
if (userName != null && password != null)
{
if (!userNames.Contains(userName))
{
byte{} passwordChars = ASCIIEncoding.ASCII.GetBytes(password);
Console.WriteLine(String.Format("{0}\t{1}", userName,
System.Convert.ToBase64String(passwordChars)));
userNames.Add(userName);
}
}
foreach (DirectoryEntry newChild in iisChild.Children)
{
PrintUserNameAndPass(newChild);
}
iisChild.Dispose();
}
|
Update: Actually I've found out that the exception on Windows Vista was caused by the lack of IIS6 compatibility module. So I've just had to install this compatibility module from Windows features and everything works as expected.
| C# |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
|
namespace ConsoleApplication1
{
using System;
using System.Text;
using System.Net;
using System.Net.Sockets;
public class ConsoleApplication1
{
protected const int PJL_PORT = 9100;
protected static string message = "Ready";
public static int Main(string{} args)
{
if (!ParseArgs(args))
{
return -1;
}
IPEndPoint ipEndPoint;
ipEndPoint = new IPEndPoint(Dns.Resolve(args{0}).AddressList{0}, PJL_PORT);
Socket socket;
socket = new Socket(
AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp
);
socket.Connect(ipEndPoint);
byte{} sendData;
string sendString;
sendString = String.Format(
"\x1B%-12345X@PJL RDYMSG DISPLAY = \"{0}\"\r\n\x1B%-12345X\r\n",
message
);
sendData = Encoding.ASCII.GetBytes(sendString);
socket.Send(sendData, sendData.Length, 0);
socket.Close();
return 0;
}
protected static bool ParseArgs(string{} args)
{
if (args.Length != 2)
{
Console.WriteLine("set printername and message");
return false;
}
if (args{1}.Length > 16)
{
Console.WriteLine("Message must be <= 16 characters");
return false;
}
message = args{1};
return true;
}
}
}
|
Forrás: http://vortexhunter.blogspot.com/2008/06/c-hp-laserjet-fun-fun-fun.html
| C# |
1
2
3
4
5
6
7
8
9
10
|
if (!s_inited)
{
lock (s_initLock)
{
if (!s_inited)
{
s_inited = true;
}
}
}
|
Yet another simple logrotate script. If you hate the original one, just use this one ;)
Download file: logrotate.zip
If you have an open 22 port (SSH) on your machine, and you are interested in blocking all the IP addresses that try to bruteforce your password then this script is for you ;) .
As I really don't like using custom ports for any service if there is an other solution, I had to come up with this solution instead. In addition to this script there is also private/public key authentication turned on for dropbear (the ssh server for wl500gp) - however it's annoying seeing lots of invalid connections in auth.log :) .
How to use it:
The script could be started from crontab, and as it runs for at most 5-10 seconds for small authentication log files, i start this script every 15 minutes ;) .
You should change the path for all the files used in this script to match your system - then everything should work as expected.
you have questions - shoot me ;)
Download files: bruteForce.zip
The files included in the zip contain the ip addresses that tried to brute force my system. Keep the list if you want ;)
Recently I've bought an Asus WL500GP router. Just very quickly the list of it's features:
[*]
there are custom linux based firmares available for it [*]
has 2 usb ports (supports USB hub, external hard drives, web cameras, card readers, usb sound cards) [*]
high quality design ;)
 (i've opened my router and added a small 4GByte microdrive so it has a permanent harddisk attached. WARNING: this voids its warranty !!!)
It has a really wide package support, and can be used as a real NAS with multiple harddisks.
Anyways - stay tuned: I'm going to publish a few tutorials on how to do stuff with the router ;)
I have a Vista Home Premium edition running on a Toshiba 300-11V laptop with 2G memory + a Core 2 Duo 1.8GHz CPU. I would say that it's acceptable. Not fast, but acceptable; which is all right because i always knew it requires more resources that Windows XP.
However these days I started playing around with a couple of USB pen drives to see if it really helps in Vista's performance if you plug in one of those...
First of all I was really surprised to see that a bunch of the usb flash cards were not fast enough for Vista. There is a good article on Wikipedia (http://en.wikipedia.org/wiki/ReadyBoost) which explains what kind of speed characteristics must the flash drive meet.
So finally after testing a couple of these usb flash drives and an SD memory card too I've decided to go for a 4GB SD flash card as my laptop has a built in SD card reader ...  It was a bit expensive - i might have as well bought a 1GB DDRAM module for the laptop, however I think that the performance gain with the ReadyBoost technology using the 4GB flash can be much higher then with the additional 1GB memory ...
A final word on how this whole stuff works: Windows needs files and data. These files and data when you have several programs in memory are paged to the pagefile obviously. Now the trick is that when Vista needs some items from the pagefile that were previously cached on the flash drive it will read them from the flash drive. Simple. The same is happening with some DLLs that are used frequently in the operating system - they are cached on the flash drive.
The reason why this can work is that a flash memory can be much faster on random memory access than a hard disk. I mean when you load 2 files simultanously from your hard drive the disk's head will move from one place to the other and the whole read operation will be damn sloooow - this is where Vista's ReadyBoost technology kicks in and ensures that the data is read more quickly from the flash drive if already cached ...
While I have to admit that using this memory card the performance gain in my case it's not that extreme - it is still visible, and I'm really happy I can now use my built-in SD memory card reader which until now was empty :) ...
|