Raspberry pi with auto start - raspberry-pi3

Can anyone point me in the right direction please? My C and Python skills are limited, but I have set up a R-pi3b to run a python program at boot and it is fine. I have also added a script to shut it down easily using GPIO3.
My problem is that once running, the keyboard is ineffective and I cannot get out of the script except by SSH and killing the process, which is fine if the network remains the same, but it has to move between different locations. This means I cannot access the existing Wi-fi I.P. address from the new location.
Is there a simple way (maybe using an IO interrupt) to exit the program and get back to terminal or the GUI so that I can manually alter the wi-fi details and then be able to SSH in?
The Python script running is "picframe" based on 3piD viewer as detailed here: https://www.thedigitalpictureframe.com/how-to-add-crossfading-slide-transitions-to-your-digital-picture-frame-using-pi3d/ which works very well by the way.
I am using Raspbian Buster release as suggested in the above link. PC is Windows 10 64bit.
I have tried various suggestions to allow access by re-writing some parts of the sd card from windows, and tried to follow some tunneling ideas but none have been successful. The only way I seem to be able to change the address is by reloading the whole OS and the program again which is frustrating and time consuming.
As I cannot get to the terminal at bootup there is no way to access it, unless I have missed something very obvious, using the keyboard and the external SSH will not connect either.
Any help would be appreciated.

I missed the obvious! USE THE LAN PORT! Then access via PuTTY and set the new WI FI details, but I would still value help on quitting the program and returning to the GUI or terminal while the program is running.
Ctrl + C or Z have no effect and it seems as though the keyboard is totally bypassed.
Sorry for the stupid question!

How are you running your program at boot? Have you tried to exit the program with Ctrl + C? Have you tried opening another terminal window with Alt + Ctrl + F2, for example?
It is a service that starts from systemd/user and is a python script.
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import re
import sys
from picframe.start import main
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(main())
I had not come across Alt + Ctrl + F2 but will try it as soon as I get back to it. Thanks

Related

Comment shortcut not working in a jupyter notebook running on firefox

There are some questions open with very similar problems, but none of them are exactly the same and the solutions suggested are not working for me, so I will open this question.
I have a non-english keyboard, without num pad, and I want o use the comment shortcut to comment one or multiple lines in jupyter notebook,
# some code
My keyboard is similar to this one,
With microsoft edge the command "Ctrl + }" works perfectly (that replace the standard shortcut, that in bigger keyboards is "Ctrl + /"). But now I moved to firefox and there the command stop working. I also tried a lot of key combinations randomly and none seems to work.
Someone knows what could be the right key combination? Or a way to check which one it is, or to change it?
Thanks a lot.

Run mode not there (IDLE Python 3.6)

Probably a very simple question. I just thought, after someone suggested it here, of trying (and installing) Python 3.6 on a Mac - I've been happily using 2.7 since now. I've never used the IDLE before having done everything via the command line + ATOM to write the program.
I see that 'normally' you should be able to write your program in the shell and then run it in the RUN window. However, I don't see a RUN mode in window, just the possibility of using, which you are anyhow, the shell window. I hope that makes sense!
Is this normal, or have I missed something?
p.s. I'm using OS X 10.8, if that's of any importance.
I am not exactly sure what you are asking, and whether it has anything to do with OSX, but I can explain IDLE. IDLE has two types of main window: a single Shell and multiple Editor windows.
Shell simulates python running in the interactive REPL mode that you get when you enter 'python' (or 'python3') in a console or terminal window. (The latter depends on the OS.) You enter statements at the >>> prompt. A single-line statement is run when you hit Enter (or Return). A multi-line statement is run when you hit Enter twice. This is the same as in interactive Python.
Editor windows let you enter a multi-statement program. You run the programs by selecting Run and Run module from the menu or by hitting the shortcut key, which by default is F5 (at least on Windows and Linux). This runs the program much the same as if you enter python -i myprogram.py in a console. Program output and input goes to and is received from the Shell window. When the program ends, Python enters interactive mode and prints an interactive prompt (>>>). One can then interact with the objects created by the program.
You are correct that Run does not appear on the menu bar of the Shell. It is not needed as one runs a statement with the Enter key.

Script to emulate physical keyboard press so that PC stays awake

I'm looking for a solution to an issue caused by an active directory policy. I use a development desktop PC however that sits under my desk in the office. That PC has a policy on it that puts it to sleep if no keyboard / mouse activity is detected for 4 hours. This is common in my case as I use remote desktop to connect to the machine rather than physically sitting at it.
I've done the logical thing and spoken to IT about getting the PC put into a differnt OU with the policy removed but they haven't acted on this yet and it is really causing me issues. (Easy if you are in the office but a pain if you are working from home!)
So I wondered if there was a simple script I could run that would press the caps lock key twice every 3 hours - but in a way that would be seen by the PC as a physical key press rather than just a script running.
Alternatively I could look into making a usb thumdrive that acts as a keyboard but I think I'd run into security issues there!
Regards
The link of where this information was extracted
The Send Keys method simulates real key strokes.
Here's an example from the same website.
Sub CommentAddOrEdit()
Dim cmt As Comment
Set cmt = ActiveCell.Comment
If cmt Is Nothing Then
ActiveCell.AddComment text:=""
End If
SendKeys "+{F2}"
End Sub
Also it comes with a nice table that translates every key in your keyboard, for the caps lock as you wanted it would be :
{CAPSLOCK}.
I have just found something ready to use:
http://www.symantec.com/connect/downloads/readynosleepexe-prevents-screensaver-and-pc-locking
It does not exactly do what you are asking for, but helps to solve your initial problem.
It moves your cursor side to side by a couple of pixels.
Following the link you could find a zip with .exe and source file in it.
The source file can be changed ( for example, to change the timeout ) and recompiled by this tool:
https://www.autoitscript.com/autoit3/docs/intro/compiler.htm
This .exe has an icon in the tray to provide a way to stop it ( or you can just kill the process from the process manager ). it also needs less than 1 MB of RAM.

How do I pause a vlc process from the command line? [duplicate]

Well i have an adobe air which runs vlc-player at background as service. i check that in Windows Task Manager , the service runs when air application launches.
here is the code
processArgs.push("--extraintf");
processArgs.push("rc"); //Remote control
processArgs.push("--rc-fake-tty"); //Use terminal as output
processArgs.push("screen://");
processArgs.push(":screen-fps=15");
processArgs.push(":screen-caching=100");
processArgs.push(":sout=#transcode{venc=x264{bframes=0,nocabac,ref=1,nf,level=13,crf=24,partitions=none},vcodec=h264,fps=15,vb=3000,width=800,height=600,acodec=none}:duplicate{dst=std{mux=mp4,access=file,dst='"+targetFile.nativePath+"'}}");
startupInfo.arguments = processArgs;
p = new NativeProcess();
p.addEventListener(ProgressEvent.STANDARD_OUTPUT_DATA, onOutputData);
p.addEventListener(ProgressEvent.STANDARD_ERROR_DATA, onErrorData);
p.addEventListener(NativeProcessExitEvent.EXIT, onExit);
now i want to close vlc-player on the button click event and i have searched the vlc- documents and found quit command and its syntax, it does not work as i have tried that syntax from windows command prompt also..
Which are the vlc-player commands that can pause,stop and close vlc-player??
Any useful link will be much helpful to me..
I've had quite a look around and looks like this (--rc-fake-tty) can't be done from Windows command line. Which means your current approach is out.
I don't no anything about Adobe but I have done some searching around and this guy has something written in C using the libVLC. Not sure if that will help or point you in the right direction.
The other thing I found was this post Adobe Air and VLC player which mentions that you should be able to use javascript and ActiveX controls on Windows. A guy in this forum has a javascript script which uses an ActiveX control to start, stop, pause etc.
There is a VLC command that you can send to override or set certain hotkeys. Search for next, prev, stop, quit, vol-up, etc in this document.
That's the best of my Googling abilities, hope it helps.
I dont want to agree that your code runs well on windows, becasue --rc-fake-tty will not run on windows, to hide the entire vlc window (it will be listed among the processes in Windows Task Manager) use --rc-quiet but to see command window use --no-rc-quiet.
To stop and quit using p.standardInput.writeUTFBytes("stop" + "\n"); is not working for me as well.

Completely locking down Windows 7 using Python 3.2?

This might be a more difficult question since I don't even know how to do it outside of Python...
I want to write a terminal program that completely locks up my PC until a password is entered. In the locked state no one should be able to do anything outside the terminal. In it, the user may rampage and write silly commands, but he should not be able to switch windows, click outside of it, open the task manager, open the menu with Ctrl + Alt Gr + Del and so on.
While searching for a way to accomplish this I've thought of two approaches that Python is also able to do:
Modifying the registry -> can disable task manager and some other functions, but not the app switcher neither the menu
Task-killing explorer.exe and dwm.exe -> killing explorer.exe just removed the taskbar, killing dwm.exe seems like the right way, but as it's the window manager it automatically boots up itself again as soon as it gets killed
I know this is a kind of weird question and doesn't contain any code snippet, but the front-end is no problem and as said I don't even got a working approach for the back-end.
write a while loop
Into the while loop write the command to taskkill dwm.exe
It's a poor solution, but the only one I know.
Regards!

Resources