I hate reading error logs. Every time something goes wrong during development and I flip over to the error log up to see what's gone wrong I'm depressed. What I really want is a way to have specific errors invoke sound effects on my local machine. For example, every null pointer error should make the sad trombone clip play, an array out of bounds exception could be a falling slide whistle, and so on.
Is there a way to set this up for my Windows console window?
Edit
Environments are Haxe targeting SWF 10, Rails 3 on Webrick, and a standalone Java application. All run in a standard Windows 7 console window.
I don't use windows much nowadays. With that said, here's how I'd do it:
Download and install cygwin, just to get bash and basic unix utilities, specifically, tail and grep. Those three should be enough to do the job, plus a $sound_player. You might be able to bypass cygwin and install bash, tail and grep independently.
Open one bash shell for each kind of error that you want to make noise of.
$ while tail -f $LOGFILE|grep $ERROR_MESSAGE; do $sound_player $SOUND_FILE; done
There should be a way to do the equivalent of the above using the windows shell (cmd).
Related
I am currently struggling with v4l2loopback installation on WSL2.
Some context:
Recently, I have read about create a virtual video device in Linux and then mock its output from an image or video file.
This is quite important for testing or developing purposes, for example in order to attach a virtual webcam that reproduces a video file as a loop to the android emulator.
After some research I got to the conclusion I don't want to use desktop applications and it might be easy to run even in a CI or similar, therefore v4l2loopback looks nice, but I am currently a Windows user.
I enabled WSL2 on my machine, downloaded the repo, and tried to execute make command like in the repo description.
Building v4l2-loopback driver...
make -C /lib/modules/`uname -r`/build M=/home/angel/v4l2loopback modules
make[1]: *** /lib/modules/4.19.84-microsoft-standard/build: No such file or directory. Stop.
make: *** [Makefile:43: v4l2loopback.ko] Error 2
I googled a little bit and i found that issue on GitHub where a similar output (for another tool) is mentioned.
There, someone mentioned that WSL2 Kernel Config can be adjusted in order to add more modules ( maybe and hopefully one of them could make work v4l2-loopback 😂 or at least that I think).
I also googled in order to check out custom WSL builds but I am not really sure what I need to make it work or even if I am going in the right direction.
Is there something I 've missed in order to make v4l2loopback work?
In the case only a custom WSL2 build would work, how should I proceed?
Thanks in advance 🤘
I am not familiar with WSL...
-- Ah, it appears WSL doesn't have a linux kernel at all: see
https://unix.stackexchange.com/questions/594470/wsl-2-does-not-have-lib-modules .
So it's useless building the v4l2loopback mod; even if you'd be able to build it, there's nothing, no kernel, to load it!
Maybe an alternative for you might be running Virtualbox (it's free, and available for Windows) on your windows machine, and load a real Linux distro of your own choice in it. Then build the v4l2loop module, after installing the kernel development headers, and install the mod (after building, as root do insmod v4l2loop.ko) and play with it.
Thus, you are on your way. Far more elegant, and far easier. Also will have you make an enormous and important climb on the 'getting familiar with Linux' ladder, as well as maybe familiarize yourself with a virtual machine(?).
I'd definitely go for that.
I recently ran into an issue that I want to share Q&A style here. Hopefully it will help others, at minimum it is documented so I can find it later :)
When trying to run Ncurses in CodeBlocks it blows up when it hit initscr();. With VSCode this was not a problem, so I know there was something I am missing. With the help of StackOverflow it appears the best way to approach this with gdb (and CodeBlocks) is to attach to the process itself after it is running, rather than starting it in CodeBlocks. (Debugging ncurses application with gdb)
However, when I try to attach to the PID it just says that it was unable to attach to the process. Why is this?
I found that if I tried to run it through gdb on the commandline I also got this same issue. It comes from Kernal Hardening to prevent hacking. With this answer: https://stackoverflow.com/a/32274645/1770034
I discovered I needed to switch over to the root user. Then run echo 0 > /proc/sys/kernel/yama/ptrace_scope Now Code blocks will happily attach to the process and you can use your break points.
I'm not very experienced in *nix operating systems and I'm trying to set up an embedded programming environment in WSL, but I'm getting hung up on basic issues. Last time I was working on this project I had downloaded some files (cargo and rustup, but that shouldn't matter), and I confirmed that they were there and working by getting the version number with -V.
After restarting my computer WSL doesn't recognize rustup or cargo as commands, and the folders don't show up with ls, even though they show up when I check for them in Windows Explorer.
The directory I've been working out of is %LOCALAPPDATA%\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs\home*user* which I'm pretty sure is the default. I’ve verified this by creating a .txt in WSL and finding it with Windows Explorer
Working on Windows 10 64-bit. I chose Debian for arbitrary reasons/ open to switching.
I’m not too worried about the files themselves, I just want to be able to avoid this in the future.
Firstly since you are new to WSL please be aware that the recommendations are to not under any situations edit or modify any Linux files inside of your %LOCALAPPDATA% folder using Windows apps or tools which includes moving files using file explorer. See this blog post from Microsoft https://devblogs.microsoft.com/commandline/do-not-change-linux-files-using-windows-apps-and-tools/ If you do you can see corruptions missing files and crashes.
I have no experience with cargo or rust but it sounds like you didnt update your .bashrc (start up script) with details needed to add things to the environment on start up.
There are a few things you can do
Use the history command to look back at what you did when you installed things
Use sudo find / -name rust to look for the executable in your system
When using ls remember that files/folders that begin with a dot are hidden so you need to use ls -al to see them in the terminal
I assume you followed this guide for installation (or similar). If you did not and are still having issues please detail how you installed things.
I developed a GUI application for macOS to record video from a computer screen. Can I add support command line? Example,
$myapp -start // Start recording video
$myapp -stop // Stop recording video
and etc.
If it's possible, then how can I implemented it?
It would probably make more sense to create a dedicated command-line tool, built by its own target, and include that as a "helper" executable in your application bundle.
You can then have your application install that as a command-line tool in /usr/local/bin/ by copying it, creating a hard link, etc. If it's a completed tool consider also installing a man page for it.
I am trying to create an Automator Service that runs an applescript that eventually runs a bash script to ssh/scp to a server:
--
I have this applescript that saves my current photoshop document and calls a bash script to scp the image to a server. The bash script then runs ssh to do some stuff on said server with the image.
I have an ssh-askpass file and it seems to work well in most situations. I even tried reinstalling it to make sure I didn't goof on permissions, but it seems to be in good shape.
If I just run the applescript through Applescript Editor, it works fine and goes through ssh-askpass.
I want to create an Automator action (using the "service" template) to run my applescript, so I can just make it into a keyboard shortcut.
If I just run the script in Automator, everything works fine. Unfortunately, when I try to use the service outside automator (ie App Menu > Services), it seems that my Automator action is not attempting to go through ssh-askpass at all (which I verified with temporary logging)- everything works fine up to that point.
I looked into it a bit more, and it appears that a similar issue occurs when I try to run the applescript from the terminal (and not Applescript Editor)
--
Is there something different I need to do to ensure that an applescript (in Automator) uses ssh-askpass?
I found the issue. In the bash script I was calling, I was exporting the SSH_ASKPASS path, but not the display:
export DISPLAY=":0"
Apparently the AppleScript Editor (and XCode and Automator) does the exports for you, which is why it was working in those cases.
If you have control over your account on the server (e.g. shell account), I would just generate an SSH keypair and use it for authentication. That way, you can truly automate the exchange and not have to deal with ssh-askpass at all.
See http://paulkeck.com/ssh/ for a guide to making and deploying SSH keys.