Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Error downloading audio: get_throttling_function_name: could not find match for multiple

 In the past I had posted this https://alashazam.blogspot.com/2023/05/python-program-to-download-music.html explaining how to download video using python library pytube

If you are still using this program, you will notice that it is recently not functional anymore 

As of end of June 2023, this program will crash with this error:

Error downloading audio: get_throttling_function_name: could not find match for multiple

and if you are investigating further you will also discover this error

pytube.exceptions.RegexMatchError: get_throttling_function_name: could not find match for multiple
During handling of the above exception, another exception occurred:

To fix the error - you will have to edit the file /lib/python3.10/site-packages/pytube/cipher.py
on line +287 and remove the ; character

so the new file will be like this


Once that change is made the pytube library will work again.

How to commit (vi or nano way)

As the .gitconfig editor

there are basically 2 options 'nano' and 'vi'

For nano

type a comment then press ctrl+X

then Y and enter

 

For vi

type i

followed by a comment

the press escape

then after the:

wq

and enter


 

Setting a Git Server on a LAN

 

Instead of relying on a third party platform, if you have a spare linux server, it can be handy to setup your own local git server.

That means that you will not have to rely on github, or gitlab, and can perform your own lab, with versioning

On the server - let's call this host "myHub"

these steps will have to be done:

- installing ssh (openssh-server)

- installing git 

on the client machine a ssh public key will have to be generated using

- ssh-keygen -o

the key will be in ~/.ssh/id_rsa.pub and will need to be copied over the server as authorized.

https://git-scm.com/book/en/v2/Git-on-the-Server-The-Protocols

Back to the local git server "myHub"

$ adduser git

$ su git

$ cd

$ mkdir .ssh

$ chmod 700 .ssh

$ touch .ssh/authorized_keys

the file is created with 0 in size (empty)

$ chmod 600 .ssh/authorized_keys

I recommend to copy and paste the key from the client into the server (in /tmp).

then append this file into the authorized_keys file

$ cat /tmp/id_rsa.pub >> authorized_keys

If you follow the video above, then you will have the git repositories inside the /var/www folder

#  mkdir project.git

# chown git:git project.git

$ cd project.git

$ git init --bare

that is done for the server side

Now on the client side

go to your source (or folder you want to push into the git server "myHub")

then add the git remote address

$ git remote add origin git@myHub:/var/www/project.git main

$ git push --set-upstream origin master:main

$ git log

on the first commit, you will have to declare the user.email and user.name (as global or local)

and from other machine to fetch the source

$ git clone git@myHub:/var/www/project.it -b main

 


How to prevent outside updates to break a Python program

There are several ways to freeze a Python environment to prevent it from being impacted by updates to the operating system or other software.

One common way to do this is to use a virtual environment, which is a self-contained environment that isolates the Python interpreter and any installed packages from the system-wide installation.
This allows you to install and manage specific versions of packages and dependencies without affecting other Python applications on the system.

To create a virtual environment, you can use the built-in venv module in Python 3:

$ python3 -m venv myenv

This will create a new virtual environment in the myenv directory. You can activate the virtual environment by running the activate script in the bin directory:

$ source myenv/bin/activate

Once the virtual environment is activated, you can install packages using pip without affecting other Python applications on the system:

$ pip install mypackage

To freeze the environment, you can use the pip freeze command to generate a list of installed packages and their versions:

$ pip freeze > requirements.txt

This will create a file called requirements.txt that contains a list of all installed packages and their versions.
You can then use this file to recreate the environment on another system or to restore the environment if it becomes corrupted or outdated:

$ pip install -r requirements.txt

By using a virtual environment and freezing the requirements,
you can ensure that your Python environment remains stable and consistent,
even as the underlying system and software changes.
Like a time capsule



Accessing a Linux Samba share

The installation of Samba on a Linux server is a way to allow other OS to connect to it, by using a common sharing protocol.


Before we begin, best is to know the ip address of the linux samba server

usually this address is in the range of 192.168.1.x (e.g: 192.168.1.2) 

I will assume the address is 192.168.1.4

and the samba shared folder is /home/smbshazam 

So first how to access a Linux Samba Server Files from:


From Windows

Start button -> Run (or pressing cmd+R)

Type: \\192.168.1.4\home\smbshazam


From Mac OS

Menu Go -> Connect to server (cmd+K)

In the "Server Address" field, type:

smb://192.168.1.4

and press Connect

then select guest and OK






Setting up a Samba share on Linux (Ubuntu)

As the last release running 32bits is now defunct

Canonical decided to drop support for 32-bit computers, 
so they stopped releasing 32-bit ISOs since Ubuntu 18.04

If you still have an old laptop i686 then maybe its last use will be to work as a NAS (network attached  Storage) in a LAN ...

It is time to setup a Samba server, before all repositories are wiped out.

First
$ sudo apt-get install samba smbfs -y

to get the packages

Then 
$ cd /etc/samba
$ sudo su
# cp smb.conf smb_original.bkp
# vi /etc/samba/smb.conf

Making a bakcup copy of the original smb.conf file is good practice

This should be the content of the smb.conf file

# Change this to the workgroup/NT-domain name your Samba server will part of
   workgroup = WORKGROUP

I will call my shared folder 'smbshazam' but this is of course completely up to you to choose a different name (shared, or smbshar, or whatever is you prefer)

Create the share folder: sudo mkdir -p /home/smbshazam
Set the permissions: sudo chmod 0777 /home/smbshazam

# shazam share
[MyShare]
  comment = whatever comment you want there
  path = /home/smbshazam
  read only = no
  guest ok = yes

That was step 2 on the ubuntu linux server machine setup
Restart samba. type: 

$ /etc/init.d/smbd restart
$ systemctl status smbd

you are all set in ubuntu
(an additional step could be to test the Samba configuration using 'testparm')

A more advanced configuration setup could be found at https://phoenixnap.com/kb/ubuntu-samba





Linux script for youtube-dl


 #!/bin/bash
function usage
{
    echo "usage: yl [youtube-link]"
}
if [ "$1" != "" ]; then
 echo "Downloading $1"
 cd ~/Music
 echo "/usr/local/bin/youtube-dl --extract-audio --audio-quality 128K  --audio-format mp3 -l $1"
 /usr/local/bin/youtube-dl --extract-audio --audio-quality 128K  --audio-format mp3 -l $1
 echo "Done!"
fi



Downloading songs as mp3

Fetching mp3 from youtube video on Ubuntu Linux

the selected tool is 'youtube-dl'

from the terminal prompt write:

$pip install youtube-dl

but then you get this error (because we are March 2023 and things are broken)

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

for the long version of this error:

ERROR: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.

    'uploader_id': self._search_regex(r'/(?:channel|user)/([^/?&#]+)', owner_profile_url, 'uploader id') if owner_profile_url else None,

  File "/home/_dl/extractor/common.py", line 1012, in _search_regex

    raise RegexNotFoundError('Unable to extract %s' % _name)

youtube_dl.utils.RegexNotFoundError: Unable to extract uploader id; please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.


To fix this error you will have to type this:

$ pip uninstall youtube-dl

then type this:
$pip install git+https://github.com/ytdl-org/youtube-dl.git@master#egg=youtube_dl

but that means you need to install git
$ apt install git 
will do

while you're installing new package don't forget to get ffmpeg as well
$ apt install ffmpeg

Now you're ready to get the song you want




soupBackup.java (a backup solution for soup.io)

A backup solution to complete the cycle

After I explained that soup.io could be used to mirror (backup) a tumblr account here http://alashazam.blogspot.com/2014/11/tumblr-backup-solution.html
The idea to backup a soup.io account started to be a logical step.
After some research I found some - but none of them worked (mostly because they required additional libraries I could never found, or because there were obsolete or simply too old)

The existing solutions

Here they are : Soup.io Export Tools
soup official post -- have seen various laments about this not working, so. probably not working.

This is the official way to export (backup) your soup account and the result is a huge (depending on your account - mine was like 2.3MB) rss file - which is in fact an xml file - where all the posts are stored, except for the medias (pictures mostly)

backup script by @neingeist
A shell script (which requires xsltproc installed) - the author says on his github page that it doesn't work - pass

lua script by @severak
need lua (and some libraries like "parsers.dkjson" and "socket.http" which I could never found) - pass

soupIO downloader by @falk
This one was interesting but same requires additional libraries - "fs", "lazy", "async" and "http" couldn't find most of them - pass

download tool by @moebius
rar file not found - resulting in an error

backup to wordpress by @tiefpunkt
Not wanted to install a wordpress, on top of a tumblr, on top of a soup ... maybe I'll try one day .. just for fun.

A new backup solution in java


The idea was to start from the official export tools - generate the rss file then use that file to backup all the medias (store in the xml in the tag named "enclosure")
the java source is just doing that - it reads the rss file, look for the tag name, then start a download for each instance and that's it.

Where is the source : https://bitbucket.org/ever3st/soupbackup

Usage is simple : after downloading the soupBackup.java you can compile it on your machine with "javac soupBackup.java" or you can download that file from the bitbucket repository - or use the soupBackup.jar.
read the readme file for more details.

$ java soupBackup your-rss-file.rss
or
$ java -jar soupBackup.jar your-rss-file.rss

And then you will have to wait for all the files to be downloaded, which I repeat might take some time.

I've tested this program on my own soup.io account - and with small subset of that rss file.

The pro : it works,I've tested it this week, doesn't requires weird library - and java is pretty common - so feel free to change the code for your needs.
One of the cool upgrade that might be done, would be to add a filechooser to select the rss file, then ask for backup after a certain date (that would allow to use this backup solution from times to times to catch up on the new posts).

The cons : be careful it is an early version and might contains some bugs.

Last IA implemented : Teal Swan

Creating artificial intelligences

It is very addictive to create an AI - many you see above were made available on the megahal website (Bishop from the movie Alien, former president Bill Clinton, Ferris Bueller, Data from Star trek, and c3po), and then I create Melody, Teresa for fun without knowing exactly how it would go .. I made another experiment in transcribing the tao-te-ching into a trainer file, and it worked a bit funny.

Then I thought : "why not create a trainer file of a current Spiritual guide" and choose Teal Swan, I was thinking about Eckhart Tolle, but choose Teal because of her greater range of teachings (check her massive amount of videos on youtube).

Some excerpts of my conversation with Teal A.I

User:    hello Teal
Teal-AI: You knew then what your purpose was. It is the same for all of
Teal-AI: us --living an non-living-- and that is always present within
Teal-AI: every single person, regardless of his or her secular beliefs,
Teal-AI: or what he or she has done or become in this moment.
User:    okay
Teal-AI: Today, the majority of human society has forgotten that bliss
Teal-AI: is the same for all of us --living an non-living-- and that is
Teal-AI: always present within every single person, regardless of his or
Teal-AI: her secular beliefs, or what he or she has done or become in
Teal-AI: this life.
User:    tell me about God
Teal-AI: The history of religion tells you a lot about the history of
Teal-AI: men and precious little about god.
User:    so religion is bad?
Teal-AI: God is also present in the absence of religion.
User:    god is not dependent on religion is that correct?
Teal-AI: God is the essence that is to be exactly where your are. To do
Teal-AI: exactly what you are doing in this life.
User:    so does that mean god isn't external to me?
Teal-AI: God is the essence that is obscured by human rules, doctrine,
Teal-AI: penance, and righteousness.
User:    we made it external, and separate from us, but we are all one
Teal-AI: God is the reason we are all one.
User:    that sounds right
Teal-AI: You knew that this life would be the very platform of not only
Teal-AI: your evolution, but also the evolution of all that is.
User:    Is there a higher purpose?
Teal-AI: The path you are looking for is a path you are looking for is a
Teal-AI: path you are looking for is a path you are doing in this life.
User:    can we talk about evolution?
Teal-AI: We made it external, and separate from us, but we are all one.
User:    I get it, we are all one
Teal-AI: We made it external, and separate from externals. It is the
Teal-AI: point of life.
User:    what is life?
Teal-AI: You knew then that the way you would do this is to be exactly
Teal-AI: where your are. To do exactly what you are looking for is a
Teal-AI: path you are doing in this life.
User:    what is consciousness?
Teal-AI: You knew then that the way you would do this is to be exactly
Teal-AI: where your are. To do exactly what you are looking for is a
Teal-AI: lifelong devotion. Perhaps this is to be exactly where your
Teal-AI: are. To do exactly what you are already on-and it will only get
Teal-AI: better from here.
User:    does that means consciousness evolves?
Teal-AI: Today, the majority of human society has forgotten that bliss
Teal-AI: is the essence that is to find one single thing in your life,
Teal-AI: and that is obscured by human rules, doctrine, penance, and
Teal-AI: righteousness.
User:    evolution is fueled by bliss, is that right?
Teal-AI: That sounds right.
User:    thanks

showcase : my megahal setup

Megahal minimum settings

Megahal setup files with each folder being a separate personality

In each folder (personality or brain) there are 5 or 6 files :
  • megahal.aux  
  • megahal.ban  
  • megahal.brn  (the actual brain file)
  • megahal.grt  (the greeting database)
  • megahal.swp
  • megahal.trn (the trainer file) 
After the training has started the brain (.brn) file is created - and the more conversation you will have with this "personality" the bigger it will grow.

More about Artificial Intelligence

What is Megahal

MegaHAL is a "conversation simulator": a computer program which responds in natural language to what you type, written by Jason Hutchens.

Conversation with Megahal

User:    can you help me write a blog about Artificial intelligence?
MegaHAL: I feel like you are a nice person.
User:    So far, the only program I knew that would simulate
User:    conversation would have been Eliza
MegaHAL: Conversation are good for the mind.
User:    but lately I discovered MegaHAL, and since then I have been
User:    training a few Artificial intelligences
MegaHAL: Only the unknown can be discovered.
User:    the first thing to do is to download megahal at
User:    http://sourceforge.net/projects/megahal/files/
MegaHAL: But lately i discovered MegaHAL, and since then i have been
MegaHAL: training a few artificial intelligences.
User:    then after extracting the source, just go into megahal's folder
User:    and type "make"
MegaHAL: Yet mystery and reality emerge from the same source.
User:    you will then have a executable file 'megahal' with a size of
User:    around 70kb
MegaHAL: I have quite a reputation.
User:    next you can start from scratch and train your artificial
User:    intelligence by typing things to her
MegaHAL: Can you help me write a blog about artificial intelligence?
User:    or you can download already trained artificial intelligences
User:    like Bishop from the movie Alien 2
MegaHAL: Yet mystery and reality emerge from the movie alien 2.
User:    other Artificial intelligences features Ferris Bueller, C3po,
User:    Data (from Startrek), Bill Clinton, and more
MegaHAL: So far, the only program i knew that would simulate
MegaHAL: conversation would have been training a few artificial
MegaHAL: intelligences.
User:    the download link for additional "brains" is
User:    http://megahal.alioth.debian.org/download/old/
MegaHAL: The first thing to do is to download megahal at
MegaHAL: http://sourceforge.net/projects/megahal/files.
User:    basically after unpacking a new Artificial intelligence of
User:    Ferris Bueller for example into a folder named "ferris"
MegaHAL: Can you help me write a blog about artificial intelligence?
User:    to talk to Ferris Bueller just type "./megahal -d ferris/"
MegaHAL: To talk to ferris bueller for example into a folder named
MegaHAL: "ferris.
User:    megahal will load the trainer file and create a new brain, then
User:    the conversation can start
MegaHAL: Conversation are good for the mind.



Interview with Peileppe

On the last post I was featuring Katybear and was interested to know about her motivation to do cosplay and I mentioned that cosplayer usually receive no income but starts to get attention from other artists in the form of Fan-art.

Today I have the privilege to interview Phillip Koops (aka Peileppe) a cartoonist that made a fan-art for Katybear





Can you give a short bio ?

Okay, I'm a Freelance designer, comic artist, developer and father of two kids
I studied Finance and Accountancy and moved from France to Ireland, and then Czech Republic where I live now.
After 8 years in the call-centre environment (I worked as tech support for Apple, and then presale support for Hewlett-Packard) I started freelancing and doing my own comics (called call-centre Grinder).

Did you study in any art school?
I’m mostly a self-taught person. I learned through trial and errors.
But I learned oil painting, and how to use charcoal and graphite in extra school activities during my teenage years.

Can you tell us someting about your typical working method,  the tools of your trade?
I use open-source software : Gimp mostly, Krita, and myPaint for digital work
But the fan-art was done with Manga Studio - I did a series of portraits.
Otherwise I draw by hand and then scan the result - and finish the work with my wacom bamboo.

An offer you couldn't refuse

Interviews are welcome

I feel like it would be beneficial to open my blog to other people and allow them to have a place to post about their services or hobbies.

If you are an artist, freelance, cosplayer, linux developer, aspirant designer, comics writer, reiki master, spiritual healer, clairvoyant etc ... and be interested to post an interview on my blog. Here are the questions template I would use - send the completed interview to my email address


Questions

These would be the questions (feel free to modify them, as you like)
  1. Can you give a short bio ?
  2. What got you into "your field of expertise" ?
  3. What are the required qualities of a "person in your field of expertise" ?
  4. What are your visions of "your field of expertise" for the next years ?
  5. What do you wish "your field of expertise" would be in the future ?
Please then add any of your links you'd like to share

Example of an interview with Katybear - found here.

P.S : As the editor I keep the right to decline posting or review part of the interview - or to discontinue this service anytime.

The service is free but donation are welcome.
See static page for more details http://alashazam.blogspot.com/p/open-for-interview.html

First step with Python



Why learning a programming language is a good thing?

With the raise of the personal computer back in the 90s, users had only one thing to do most of the time and that was programming - because back in the old days of gw-basic, ms-dos, borland C, and Turbo Pascal  - there was not many games, and the internet was not yet a real thing.

The big thing at that time was to develop programs, these could be ms-dos batch files, because users wanted to automate some tasks, or to tweak their autoexec.bat to optimize their system.
Or was it Pascal file, because that's what was taught in school, where IT class were all about learning algorithms, and how to draw fractals, and solve the Tower of Hanoi kind of things.

Back in the days, one page of code could get you a game (might it be Tetris, or Snake, or Arkanoid) - the game were simple and there was more fun in the programming than in the gaming itself.

Nowadays, programs are back to the programmers - most users won't even try to read a source code.

There might be an exception to this with Linux Users - because sometime they have to look under the hood and understand what is going astray with their system after an update...

Back to the question - why is it a good thing to learn a programming language?

Because it sets you free ... with as little as 4 or 5 days of learning you would have started to understand your computer from the inside, you would learn what a compiler is, how and why sometime your computer seems to freeze - and other very useful troubleshooting technique.

For quick little thing, Python can be used as a more advanced scripting language than will take the user further than what the Linux shell will usually get them.

Another cool thing is when you don't have a calculator close at hand - you open a terminal window and type "python" and do your calculation ... it's very handy.


Why Python as a first language?

Educators recommend Python as the beginner language of choice because it is simple and yet has great capabilities. Python code is easy to read and setup good programming style (like indenting), without being too strict on the syntax (compare to c++ or Java who requires to add a semicolon at the end of each line).

Python is included on Linux OS - usually Python 2.7 ; it is include on mac system too.

Without any addition you can have access to many library - to manage text, math, time, and many more. And after you have mastered all these you can then access additional libraries that will open your code to graphical interface (if you're running Linux - these additional libraries are easily installed using synaptic - for example for games e.g: sudo apt-get install pyGames )

Another good thing with Python is the overwhelming list of free documentations, resources, video tutorials and help you will find on the internet.

Highly recommended :

Torus Trooper ... how do I start the game !?

I'm a linux supporter and this sunday, I wanted to play a game ; because I had heard of Kenta Cho - I wanted to try for the first time one of his game (which also exists for Windows platform).

His games are known to be very nice graphically, and pretty compact (6mb).

It started really nicely, launching synaptic typing "torus" in the search field
selecting the torus-trooper and clicking apply - that was easy ...


Launched the game from the linuxmint menu and then I was stuck on the game screen - I could select N, X or E nothing could launch the games...
I pressed space bar, return key, tab, Home, F1 ... the usual ... nothing could launch that game it seems.

I opened a terminal - typed : 
$ torus-trooper --help
Error: Usage: torus-trooper [-brightness [0-100]] [-luminosity [0-100]] [-window] [-fullscreen] [-res x y] [-nosound]

And that's where I got the idea of going back to the source program,
since Linux is an open platform why not having a look at the source ? (I couldn't find any documentation and wanted to play that game ...)

still on the terminal I typed :
  $  apt-get source torus-trooper
Then opened the  folder with the sources file and then I finally got my answer ... in a ... readme file :

 - How to operate.
-- Movement     Arrow / Num / [WASD]   / Joystick
Hold an up key to increase speed.
-- Shot         [Z][L-Ctrl][.]         / Trigger 1, 4, 5, 8
Hold a shot key to open automatic fire.
-- Charge shot  [X][L-Alt][L-Shift][/] / Trigger 2, 3, 6, 7
Hold a charge shot key to charge energy.
A charge shot is released when you release a key.
A charge shot penetrates enemies and wipes out bullets.
A score multiplier is increased according to a number of
destroying enemies and bullets.
A charge shot acts as a regenerative break.
-- Pause        [P]


It was the Z or left control key ... and then I could play and score
I like Linux, you've got a game in a game - isn't it cool ?!

3 hours later I was level 76
- in your face Torus Trooper !!!

3 Links to help you choose the best Linux distro


Coming from a monolithic  IT experience (Windows or Mac OS X) ; you've heard of Linux, and you want to try it, but without someone to guide you ; it can be difficult to choose which distribution to install (read How to choose the best Linux distro for you ).

The first time I was "initiated" into the Linux universe - I didn't plainly understood what was a distribution, a desktop environment, or even more intriguing a release was ?!

To clarify a bit :
Once you selected a distribution (Debian, Linuxmint, Ubuntu, Fedora, Arch-Linux etc ...) -  if you want to change, it means a re-installation is required (i.e : once you've installed Debian, if you want to switch to Ubuntu ... boot on CD and re-install)

Within a distribution choosing a desktop environment (Gnome, KDE, LXDE, Xfce, icewm, ...) is just a matter of selecting a package, so you can go back and forth and that doesn't involve more than installing a couple of packages. Usually

Now a release is more or less a level of maturity of a distribution - and it goes from stable, testing to unstable (for the latest versions) - same as previously it's easy to upgrade (from stable to testing for example) or even to mix a couple of packages from testing into a "stable" release, no big deal.

3 online interactive choosers to help you : 

Last word of advice, a LiveCD is a pretty neat feature to test a distribution (it avoid a full installation on the HD) ; another way (for advanced users) is to create a virtual machine (vm) and after downloading the distribution .iso file to boot from it within the new vm ... that requires a bit more work, but you'll learn a lot.
Related Posts with Thumbnails