Coding with Titans

so breaking things happens constantly, but never on purpose

Wake-on-LAN from Raspberry Pi and Synology NAS

Some time ago I have written a post about, how to setup Windows 10 to wake it up remotely via network using magic packet. The question that remained unanswered is: how to actually send this packet to the PC to trigger it running. In the first example I will use Raspberry Pi with Rasbpian Stretch Lite installed: First make sure a tool etherwake is available. If not, this could be fixed with following command, otherwise skip this step: sudo apt-get install etherwake Then simply invoke it with proper arguments: sudo etherwake –i <ethernet-interface-name> <PC MAC-address> Some explanations: Read more →

Restore SD card original size on Windows

Since I play a lot with IoT using my Raspberry Pi – on both – Windows and Raspbian, I ended up holding several SD cards, which don’t report almost any size on Windows. Somehow they are seen only as 70MB disks, even if they originally were 32GB cards. Where are then the missing bytes? Believe me, they are there and it’s simply the partition table (written on top of the SD card) that makes them hidden or treated even as unallocated space. Read more →

Sending Ctrl-C signal to another application on Windows

I have a few command-line applications running on Windows. I haven’t written them myself, they are just ports of some Linux/Unix utilities. And there are situations, when I simply want them to stop or to pay more attention to me. Sure, I could make them to exit using TerminateProcess from my manager application, but this seems to be quite rude, even in the IT world. Much cleaner and nicer way would be to send them a polite notification, that would wake them up, allow release used resources (as some communicate with remote servers) and handle the exit themselves. Read more →

Current directory in batch file

Let me test syntax highlighting on this new blog with the following simple snippet. set CurrentDir=%~dp0 set CurrentDir=%CurrentDir:~0,-1% It simply gets the full path (drive plus directory) without the trailing backslash, where the executed script is located. It useful in all situations, where you have have other resources next to the script and you don’t want to relay on current working directory to access them. Read more →