Command Line Erico

This is where I post things, from command line

How to stream audio from Ubuntu to DLNA device

March 25, 2018 — Erico Porto

pulseaudio-dlna on ubuntu

Today I wanted to stream the audio from my ubuntu 16.04 to a dlna device. I had to install from the git source instead of the ppa because I had a conflict with chardet package in my system. the error was "error: chardet 2.3.0 is installed" but chardet<3.1.0,>=3.0.2 is required by set(['requests']).

here are my commands to install pulseaudio-dlna:

cd ~
pip install chardet
mkdir pulseaudio-dlna
cd pulseaudio-dlna/
git clone git@github.com:masmu/pulseaudio-dlna.git
virtualenv --system-site-packages .
source bin/activate
cd pulseaudio-dlna/
pip install .
pulseaudio-dlna &

You can create a script to start the pulseaudio-dlna when the computer starts. You can get more info about pulseaudio-dlna in the repository.

If you need a dlna device to test, you can install Bubble UPNP on your Android device and have it as a remote sound sink.

Tags: dlna, pulseaudio, sound

On History and VIM

January 24, 2017 — Erico Porto

The command line is an effective way of getting things done. One of the things I like the most is how obvious are the tasks that deserves being automated by just running the history command and checking what you do most.

I did some adjustments in my history, like making it twice as big as default settings in Ubuntu. I operate the history a lot, mostly with ctrl+r in bash, and then I can use my brain to remember other things. When I am lazy I throw some history | grep command I don't remember parameters, pandoc and tar are good examples. Some git magic I usually anotate as a gist in github since I have a haystack of git commands in my history.

The thing about history is that once you deal with a lot, you eventually will fall into having carefully written bash scripts that make your work easier - like publishing a python lib to Python Package Index.

And while you are at the command line, I really recommend you to learn vim, it's an awesome text editor that can be extended with many plugins. My favorite right now is ZenRoom2, that can be called by typing :Goyo, it will give you a confortable place to write texts distraction free.

Tags: VIM, command-line-tools

Using Pandoc as a Markdown to Docx converter

March 03, 2016 — Erico Porto

So, I don't really like Word. But it's nearly unavoidable, especially in office environment (see what I did here?).

Word has some good things, it can be read and edited by most people and can be easily converted to Kindle format.

So the command line:

pandoc -o output.docx -f markdown -t docx input.md

Tadah! And if you are in Windows right now, one good thing is that you can run pandoc without installing - doesn't require being admin! Also I've made a .bat for making this easier in Windows. The bat in action below:

drag and drop

If you need help writing markdown, here is a cheatsheet!

Tags: command-line-tools

Downloading subtitles by the command line

March 17, 2016 — Erico Porto

Today I want to show you guys the awesome tool that's Subliminal, by Diaoul. Subliminal allow you to download a subtitle for a downloaded series or movie by using the command line (did you bought Angry Video Game Nerd or PHD Movie and was surprised it had no subtitles in your language?).

First you have to install it. Assuming you have pip and python on your system:

sudo pip install -U subliminal

After the instalation, you can use the follow command from command line to download a subtitle (I'm going to use brazilian portuguese):

subliminal download -l pt-BR movie-filename.extension

And that's it! Use -l en for english subtitles. The software also has a Nautilus extension that gives cool right click subtitle download for movie files - you can check on the project's webpage on github.

I just use the command line, right now trying to bake a script to automate subtitle downloading.

Tags: command-line-tools

Having fun with a home server

March 16, 2016 — Erico Porto

Recently I decided to use a spare d525mw Intel board I had to build a small home server. This board has soldered, fanless, atom dual core processor soldered on it, I'm running it with 4GB RAM and an old Samsung 500GB HDD.

For the OS, I decided to use Ubuntu Server 15.10. Installing was a bit of a challenge because I have no monitors and had disabled USB boot a long time ago, so my solution was to lend a monitor just for the install proccess. In the meantime I learned about preseeding, which was fun and a good idea on how to install an OS on it in the future - the board has no hdmi.

Using a home server

So what good can a home server do? Well, right now, aside from using it as a learning tool I'm using to run a Twitter Bot I made, Transmission for torrenting things (web controlled) and Owncloud. Owncloud was a bit of pain to setup, but it's working well right now. I plan to install Plex for video streaming, mpd for audio streaming (and also playing audio on it as a radio).

The server is 3 days old, so I will update more on this in the future. If you want to see my Twitter bot, it's available, along with a nice install script and guide, on Chove Agora github page.

Tags: home-server

Hello World

February 29, 2016 — Erico Porto

This is a test post, the first post from the bashblog script!

Tags: hello-world

How to configure keyboard on Crunchbang

March 02, 2016 — Erico Porto

So this blog is written from my Old EEEPC 701 with 4G SSD. I used to run a exotic Gentoo until I've been away from it for 4 months and forget how to use it. So I've tried some distros and all and really like Crunchbang!

But it ended, so now I'm using whatever I can use until everything require or too much maintenance or too much everything. I like this netbook, it was donated to me and I like to keep using it.

Enough, let's get to the keyboard part. Basically you need to edit the keyboard file:

sudo nano /etc/default/keyboard

And if your keyboard is us intl, modify the file like this:

# KEYBOARD CONFIGURATION FILE

# Consult the keyboard(5) manual page.

XKBMODEL="pc105"
XKBLAYOUT="us"
XKBVARIANT="intl"
XKBOPTIONS=""

BACKSPACE="guess"

Then restart and everything should work! This assumes you have the package keyboard-configuration installed.

Tags: troubleshooting

How to fork your own repository on Github

June 18, 2016 — Erico Porto

Recently I had to fork my own repository on Github and looked through the web. I ended up taking the solution from a comment in a website that suggested a much complex approach.

  1. create a new repository in Github, don't add a readme or anything.

  2. clone it on your computer

  3. add the original repository (the one you want to fork) as upstream source.

    git remote add upstream [url]

  4. fetch and merge upstream.

    git fetch upstream & git merge upstream/master

Thanks to Mark Marijnissen.

Tags: github