loading...

What are the amazing things you do with the terminal?

papaponmx profile image Jaime Rios ・1 min read

I built a custom PC, I'm rediscovering Ubuntu and my love for Gnome. Here is a brief list of things I've found so far.

  • Turn off the computer at a given time.
  • Install apps.
  • Programatically pull latest changes from development, and create a new request based on a Jira Card.
  • Fix es-lint on save.
  • Visual regression tests.

What are yours?

Discussion

pic
Editor guide
Collapse
tbodt profile image
tbodt

Play procedurally generated music! Here's a cool command I found earlier today:

echo "g(i,x,t,o){return((3&x&(i*((3&i>>16?\"BY}6YB6%\":\"Qj}6jQ6%\")[t%8]+51)>>o))<<4);};main(){int i,n,s;for(i=0;;i++)putchar(g(i,1,n=i>>14,12)+g(i,s=i>>17,n^i>>13,10)+g(i,s/3,n+((i>>11)%3),10)+g(i,s/5,8+n-((i>>10)%3),9));}"|gcc -xc -;./a.out|aplay

(It also works on Mac, but you have to install something called "sox" (brew install sox) and replace aplay with play -c1 -b8 -eunsigned -traw -r8k -.)

Collapse
jarxg profile image
@jarxg

What sorcery is this. Care to explain what is going on? :O

Collapse
tbodt profile image
tbodt

I am honestly not too sure, but the basic idea is there's an infinite loop with i starting at 0 and incrementing each time, and each byte of audio data is somehow derived from i.

Collapse
jarxg profile image
@jarxg

Nothing really amazing but I have some aliases for listening to the radio:

alias bcr='mpv http://www.berlincommunityradio.com/sites/all/themes/bcr_bootstrap/streams/bcr.m3u'
alias dfm='mpv http://dfm.nu/DFM_RTV_INT_1.m3u'
alias kexp='mpv http://live-aacplus-64.kexp.org/kexp64.aac'
alias rfb='mpv http://us1.internet-radio.com:8155/stream'
alias wfmu='mpv http://wfmu.org/wfmu.pls'
alias wfmu.rock='mpv http://wfmu.org/wfmu_rock.pls'
alias wfmu.ubu='mpv http://wfmu.org/wfmu_ubu.pls'

You need mpv, of course. For people on macOS:

brew install mpv

I suppose you can install it on Ubuntu with:

sudo apt-get install mpv
Collapse
makiten profile image
Donald

Not amazing, but I used to job hunt with lynx. I do nearly everything on the command line when I'm on Linux, though.

Collapse
papaponmx profile image
Jaime Rios Author

How does it work? Could share a little bit more.

Collapse
makiten profile image
Donald

Generally either I used lynx or lynx url-i-want-to-go-to and you'd get a text-based browser interface similar to most other text GUIs on the command line. The keyboard commands for all the typical browser functionality are on the bottom of the UI, so you press those keys for any action you want to take.

If I wanted to go to Indeed, I'd just do


lynx https://indeed.com

and then put in whatever job I was looking for and hit ENTER. lynx handles HTML-to-text conversion pretty well to intuitively figure it out from there.