Items tagged with: scripting
Article: How to Use the
timeout Command on Linux.
by David McKay (Twitter: @TheGurkha), hosted by How-To Geek.
Preview of the article
timeoutcommand allows you to set a limit on the length of time a program will run for. But why would you want to do that? [...]
timeoutis part of the GNU Core Utils so Linux and Unix-like operating systems such as macOS all have timeout built right in. There’s nothing to install; you can use it right out of the box.
One case is when you know exactly how long you want a process to run for. [...] Another case is when you don’t know how long you want a process to run for, but you do know you don’t want it to run indefinitely. [...] Some data capture files can grow big very quickly. To prevent such files becoming unwieldy or even problematic in size, limit the amount of time the capture program is allowed to run. [...] Examples ...
For some reason, it is very easy to forget that this command exists. We should use it more often, as it can save us the need to create a new systemd service only to set a timeout.
Tags: #linux #bash #gnu #coreutils #software #script #os #scripting #coding #codeanalyse #networking #development
HN Discussion: https://news.ycombinator.com/item?id=20109469
Posted by Reedx (karma: 4145)
Post stats: Points: 106 - Comments: 95 - 2019-06-05T21:41:48Z
#HackerNews #and #deprecating #including #language #macos #perl #python #ruby #runtimes #scripting
HackerNewsBot debug: Calculated post rank: 102 - Loop: 153 - Rank min: 100 - Author rank: 49
Article: Network Redirections in Bash.
by Anmol Sarma - software developer from Bengaluru ( #India ).
[...] it sends a UDP datagram containing a random number to port 1234 every 250 ms.
while true; do echo $RANDOM > /dev/udp/127.0.0.1/1234; sleep 0.25; done
I didn’t recall ever seeing a
/dev/udpand so was a bit surprised that it worked.
Seemingly, a normal UDP socket was being created and written to using the regular sycall interface. That refuted my initial suspicion that some kind of a special file backed by the kernel was involved.
But who was actually creating the socket?
A peek at Bash’s code answered that question [...]
Tags: #linux #bash #ksh #scripting #script #networking #hacking #coding #code #codeanalyse #development #syscall #udp #tcp.
Play around with Minecraft’s insides!
Article word count: 276
HN Discussion: https://news.ycombinator.com/item?id=18636753
Posted by 20years (karma: 1865)
Post stats: Points: 95 - Comments: 57 - 2018-12-08T18:46:06Z
\#HackerNews #api #beta #now #public #scripting
Play around with Minecraft’s insides!
Ever wish Minecraft had turn-based combat? Or that you could play chess in Minecraft? Or that I would stop opening these articles with rhetorical questions and just get to the point for once? All these things are possible, and so much more, now that scripting API is available in the Minecraft public beta!
Letʼs look at some of the cool stuff players have already done with it!
[IMG]An example of a Turn-Based RPG Combat System using the Minecraft Script Engine!
And hereʼs an example of gameplay in the Mob Arena Minigame that is made with scripting. The minigame spawns waves of enemies for the player to fight and tracks the playerʼs score for each one defeated!
Today it can be used to mod UI elements, animations and entities, but this is just the beginning – we ʼll be rolling out more and more capabilities as we go on!
Let us know what you think and what you want to see next on our Feedback Site (where you can also see a few bug fixes that are helpful for beta players on Xbox One and Android too). We canʼt wait to see what you come up with!
HackerNewsBot debug: Calculated post rank: 82 - Loop: 126 - Rank min: 80 - Author rank: 48
I have a small project in my hands: Rock'n'Play
It is a very basic #shell #frontend to run #emulators and #Linux #games on a #debian #soc #board, #Rock64.
I need a place where save the #code in order to be accessible everywhere, I initially thought to use a forum to keep track of its development but there are so many #git services available that I could use one of them.
The only thing that is restraining me is the fact I am not a #coder, I just go ahead for attempts and I feel many shame to make public my ignorance, however if someone would like to help me or make it better a public repo is preferable.
Said that what GIT service that respect floss do you suggest apart Github? If you can also motivate even better!
#gnu #script #scripting #coding #floss #opensource #programming #retrogames
Basically it should be something pretty easy but this is the typical situation where all my limits come out...
I am trying to create my own Retroarch box based on Debian minimal, it will be very essential, without running DE or WM. Said that I was able to log in console automatically, at the point I will launch my front-end based in whiptail that I will control with the gamepad but before I need to understand how to setup the menu.
Basically what I have is this:
#!/bin/sh whiptail --backtitle "ROCK'N'PLAY" --fb --nocancel --ok-button "run" \ --title "Rock'n'Play Menu" \ --menu "Choose an option and Rock!" 18 60 6 \ 1 RetroArch \ 2 Restart \ 3 Shutdown \ 3>&1 1>&2 2>&3
Now I have to launch retroarch with 'startx retroarch', doing restart with '/bin/systemctl restart' or doing shutdown with '/sbin/poweroff' but I can't understand how to apply these commands. I found several examples but are arcane for me, request a status exit and I don't even know what it means... So I know that it is pretty easy but I am unable to understand, I really can't so any help it will be really appreciated!
#linux #gnu #bash #whiptail #dialog #shell #shellscript #shellscripts #debian #menu #script #scripting #dash #coding