had to read those code boxes several times. Still not sure what they are about but I'm sure they are cool.
nice redshift alternative, yeah it doesn't need to be a big program, what the hell has the candian tv got to do with it? needs a wrapper to vary it at diff times of day.
Post your Command line tricks
Forum rules
Share your brain ;)
Share your brain ;)
Re: Post your Command line tricks
The first one is the vanilla way to create linux containers, so the last line is basically what happens when you use lxc-create or docker run.
The second one is more... subtle. The #include statement in C is read by the compiler at compilation time, and included in the code as if it were part of the file.
By including /dev/stdin, you get prompted to write the file to include at compile time, which means that you write the code DURING the compilation. I found that pretty cool!
The second one is more... subtle. The #include statement in C is read by the compiler at compilation time, and included in the code as if it were part of the file.
By including /dev/stdin, you get prompted to write the file to include at compile time, which means that you write the code DURING the compilation. I found that pretty cool!
BANGARANG, MOTHERFUCKER.
- wuxmedia
- Grasshopper
- Posts: 6445
- Joined: Wed Oct 17, 2012 11:32 am
- Location: Back in Blighty
- Contact:
Re: Post your Command line tricks
oh I see. This and some other things have got me doing the exercises in the C programming language book this weekend, so I do sort of get it more now :)
- wuxmedia
- Grasshopper
- Posts: 6445
- Joined: Wed Oct 17, 2012 11:32 am
- Location: Back in Blighty
- Contact:
Re: Post your Command line tricks
Code: Select all
wux@dimholt:~$ xargs -I % rgrep % /etc/passwd <<<wux
wux@dimholt:~$ wux:x:1000:1000:wux,,,:/home/wux:/bin/bash
My main point was to have that line, then backwards word delete then paste (with the newline so it just runs) then I'd decide what to do based on the output.
The '%' is a placeholder, for multiple use (think mv or cp) then use '{}' a bit like in the native find function.
Also at the end it uses the heredoc function of bash to make an input like it's a file, more famously known as the cat <<< text EOF thing.
I'd better actually get on and use it now (took ages to even work out how to describe it, colleagues are still not sure what i'm talking about - no change there then :)
source