Archive

Archive for the ‘Just Learnt Something New (JLSN)’ Category

brave browser – The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software

April 30, 2019 Leave a comment

Problem:
Got the following error when trying to update. Mainly an issue with brave browser.


$ sudo apt-get update
...
snip
...
W: An error occurred during the signature verification. The repository is not updated and the previous index files will be used. GPG error: https://brave-browser-apt-release.s3.brave.com bionic InRelease: The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software
W: Failed to fetch https://brave-browser-apt-release.s3.brave.com/dists/bionic/InRelease The following signatures were invalid: EXPKEYSIG 4FE13824E3FFC656 Brave Software
W: Some index files failed to download. They have been ignored, or old ones used instead

Solution:
$ gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv 4FE13824E3FFC656
$ gpg --export --armor 4FE13824E3FFC656 | sudo apt-key add -

Source:
https://askubuntu.com/questions/13065/how-do-i-fix-the-gpg-error-no-pubkey

Note:
Running on Ubuntu 18.0

Installing Graphite

April 19, 2016 Leave a comment

Problem:
I needed to install graphite on a Ubuntu box on vagrant. The instructions on http://graphite.readthedocs.org/en/latest/index.html were not for the faint-hearted. But after 5mins on google I got the following guide from digitalocean.com.

Solution:
https://www.digitalocean.com/community/tutorials/how-to-install-and-use-graphite-on-an-ubuntu-14-04-server

Using Dnsmasq and nginx

March 11, 2016 Leave a comment

Problem:
How to point a localhost to a different name. Eg localhost -> fake.website.com for use in local development?

Solution:
One solution was dnsmasq. Simply updating /etc/hosts was not working for me. I think there was something else I was missing out on. Following the instructions on the website listed in the source section worked for me.

Source:
http://passingcuriosity.com/2013/dnsmasq-dev-osx/

sudo: Unable to resolve host (none)

October 26, 2015 Leave a comment

Problem:
I changed the host name of my machine from penguin to penguin_1 by editing both /etc/hosts and /etc/hostname.
After which I started getting the error “sudo: unable to resolve host (none)

Solution:
Found it on askubuntu hidden among the many answers. You can not have an underscore as a name. When I changed penguin_1 to penguin-1 in both files my issue was resolved.

Source:
http://askubuntu.com/questions/59458/error-message-when-i-run-sudo-unable-to-resolve-host-none

Interesting – Using Selenium

September 8, 2015 Leave a comment

Working with Redis

August 27, 2015 Leave a comment

What is Redis?

Redis is an open source, BSD licensed, advanced key-value cache and store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets, sorted sets, bitmaps and hyperloglogs.

Download from http://redis.io/download and follow the installation instructions.

1. Start up the server

$ ./redis-server

                _._
           _.-``__ ''-._
      _.-``    `.  `_.  ''-._           Redis 3.0.3 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 17983
  `-._    `-._  `-./  _.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |           http://redis.io
  `-._    `-._`-.__.-'_.-'    _.-'
 |`-._`-._    `-.__.-'    _.-'_.-'|
 |    `-._`-._        _.-'_.-'    |
  `-._    `-._`-.__.-'_.-'    _.-'
      `-._    `-.__.-'    _.-'
          `-._        _.-'
              `-.__.-'

17983:M 27 Aug 09:29:46.683 # Server started, Redis version 3.0.3
17983:M 27 Aug 09:29:46.683 * DB loaded from disk: 0.000 seconds
17983:M 27 Aug 09:29:46.683 * The server is now ready to accept connections on port 6379

2. Connect to the server using the commandline interface.

$ ./redis-cli
127.0.0.1:6379> set "HLR:34" "{bar:'rab', foo:'oof'}"
OK
127.0.0.1:6379> get "HLR:34"
"{bar:'rab', foo:'oof'}"

# To clear the database.
127.0.0.1:6379> flushdb
OK

# To quit.
127.0.0.1:6379> quit

Source:
redis.io

Restart fluxbox off the command line

May 7, 2015 1 comment

Problem:
When switching between 1 and 2 screens, I kept on manually having to restart fluxbox.

Solution:
fluxbox-remote command allows me to restart fluxbox using a script. As I already have a script that does the switching between 1 and 2 screens this was pretty neat.

To configure
1. Edit ~/.fluxbox/init change

session.screen0.allowRemoteActions: false
to
session.screen0.allowRemoteActions: true

2. Restart fluxbox using the menu.

3. Open a terminal and run the following command

$ fluxbox-remote restart


Source:

https://www.linuxquestions.org/questions/slackware-14/how-do-i-run-menu-and-logout-from-the-command-line-in-fluxbox-864919/

Vim – Using undo branches

April 16, 2015 Leave a comment

This is a pretty neat feature that I did not know existed. I have only used u, U and CTRL-R, but a situation arose where multiple undo’s and redo’s was necessary.

:h undolist has clear documentation on how it works.
g+ Go to newer text state. With a count repeat that many times. {not in Vi} See :help g+ for more.
g- Go to older text state. With a count repeat that many times. {not in Vi} See :help g- for more.

For more, see below:
http://vim.wikia.com/wiki/Using_undo_branches

Downloading youtube videos with youtube-dl

October 4, 2014 Leave a comment

Problem:
I wanted to download lots of youtube videos, but I did not want to do so by my usual watch and download method.

Solution:
youtube-dl is a small command-line program to download videos from YouTube.com and a few more sites.

A short feature list of things you can do.

1. You can download entire playlists.

user@computer:~/lectures/discrete_maths$ youtube-dl --rate-limit 4M https://www.youtube.com/playlist?list=PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx
 PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx: Downloading webpage
[download] Downloading playlist: Discrete Mathematics
 playlist Discrete Mathematics: Collected 19 video ids (downloading 19 of them)
[download] Downloading video #1 of 19
 Setting language
 Confirming age
 h_9WjWENWV8: Downloading webpage
 h_9WjWENWV8: Downloading video info webpage
 h_9WjWENWV8: Extracting video information
[download] Destination: Arsdigita 02 (Discrete Mathematics) Lecture 1_20-h_9WjWENWV8.mp4
[download]  42.6% of 184.48MiB at 525.55KiB/s ETA 03:26

2. You can interupt and continue from where you stopped.

user@computer:~/lectures/discrete_maths$ youtube-dl --rate-limit 1M https://www.youtube.com/playlist?list=PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx
 PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx: Downloading webpage
[download] Downloading playlist: Discrete Mathematics
 playlist Discrete Mathematics: Collected 19 video ids (downloading 19 of them)
[download] Downloading video #1 of 19
 Setting language
 Confirming age
 h_9WjWENWV8: Downloading webpage
 h_9WjWENWV8: Downloading video info webpage
 h_9WjWENWV8: Extracting video information
[download] Resuming download at byte 82488037
[download] Destination: Arsdigita 02 (Discrete Mathematics) Lecture 1_20-h_9WjWENWV8.mp4
[download] 100% of 184.48MiB in 03:22
[download] Downloading video #2 of 19
 BrDto0heyaQ: Downloading webpage
 BrDto0heyaQ: Downloading video info webpage
 BrDto0heyaQ: Extracting video information
[download] Destination: Arsdigita 02 (Discrete Mathematics) Lecture 2_20-BrDto0heyaQ.mp4
[download]  20.7% of 221.93MiB at 529.26KiB/s ETA 05:40^C
ERROR: Interrupted by user

user@computer:~/lectures/discrete_maths$ youtube-dl --rate-limit 1M https://www.youtube.com/playlist?list=PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx
 PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx: Downloading webpage
[download] Downloading playlist: Discrete Mathematics
 playlist Discrete Mathematics: Collected 19 video ids (downloading 19 of them)
[download] Downloading video #1 of 19
 Setting language
 Confirming age
 h_9WjWENWV8: Downloading webpage
 h_9WjWENWV8: Downloading video info webpage
 h_9WjWENWV8: Extracting video information
[download] Arsdigita 02 (Discrete Mathematics) Lecture 1_20-h_9WjWENWV8.mp4 has already been downloaded
[download] Downloading video #2 of 19
 BrDto0heyaQ: Downloading webpage
 BrDto0heyaQ: Downloading video info webpage
 BrDto0heyaQ: Extracting video information
[download] Resuming download at byte 48193596
[download] Destination: Arsdigita 02 (Discrete Mathematics) Lecture 2_20-BrDto0heyaQ.mp4
[download]  48.0% of 221.93MiB at 533.93KiB/s ETA 03:41^C
ERROR: Interrupted by user

It tracks where you reached in the play list and when you restart is skips through videos that have been downloaded and proceeds from there.

3. You can limit the amount of bandwidth that is used.

Download Options:
-r, –rate-limit LIMIT maximum download rate in bytes per second
(e.g. 50K or 4.2M)

youtube-dl --rate-limit 1M https://www.youtube.com/playlist?list=PLTdIp1DywMlUpLHEg3ADhE6rrxhW_T5Rx

Subtitle Options:
–write-sub write subtitle file
–write-auto-sub write automatic subtitle file (youtube
only)
–all-subs downloads all the available subtitles of
the video
–list-subs lists all available subtitles for the video
–sub-format FORMAT subtitle format (default=srt) ([sbv/vtt]
youtube only)
–sub-lang LANGS languages of the subtitles to download
(optional) separated by commas, use IETF
language tags like ‘en,pt’

4. You can check for available subtitles.

user@computer:~/Movies$ youtube-dl --list-subs http://www.youtube.com/watch?v=9RPWATPdImw
 Setting language
 Confirming age
 9RPWATPdImw: Downloading webpage
 9RPWATPdImw: Downloading video info webpage
 9RPWATPdImw: Extracting video information
 9RPWATPdImw: Looking for automatic captions
 9RPWATPdImw: Downloading XML
WARNING: Video doesn't have automatic captions
 9RPWATPdImw: Available subtitles for video: en
 9RPWATPdImw: Available automatic captions for video:

5. You can download movie with available subtitles.

user@computer:~/Movies$ youtube-dl --all-subs http://www.youtube.com/watch?v=9RPWATPdImw
 Setting language
 Confirming age
 9RPWATPdImw: Downloading webpage
 9RPWATPdImw: Downloading video info webpage
 9RPWATPdImw: Extracting video information
[info] Writing video subtitles to: [English Sub] Jet Li 2011 Flying.Swords.Of.Dragon.Gate [turn on caption for sub]-9RPWATPdImw.en.srt
[download] Destination: [English Sub] Jet Li 2011 Flying.Swords.Of.Dragon.Gate [turn on caption for sub]-9RPWATPdImw.mp4
[download] 100% of 431.77MiB in 12:32

Source:
http://rg3.github.io/youtube-dl/index.html

Skype – No sound/audio when making a test call

September 11, 2014 Leave a comment

Problem:

So finally managed to install skype 4.3 on 64bit Debian Testing. Next hurdle was that I could not make a skype call as the other party could not hear me. Selecting Options->Sound Devices->Make a Test Call would result in nothing getting recorded.

Solution:
Install pulseaudio and mate-volume-controller.

So most noticible effect was that now every time skype starts up you get all the moans and groans, but still “Make a Test Call” does not play back my voice.

In skype go to Sound Devices

Skype Sound Devices

Skype Sound Devices

Click on “Open PulseAudio Volume Control”

Volume Control

Volume Control

Make sure that the internal microphone is not muted. Once I unmuted mine. I redid the skype test call and it played back my voice.