tag:blogger.com,1999:blog-236649302024-03-07T23:28:38.400-05:00{ ParsedContent };My geekiness, shared with you.Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.comBlogger198125tag:blogger.com,1999:blog-23664930.post-77710866134922271732023-10-06T21:03:00.003-04:002023-10-06T21:03:56.558-04:00Pointing CPAN To Your Local Mirror<p> I have been out of the Perl development arena for quite a while (about 10 years or so, to be brutally honest). That's what happens when your career takes you in a different direction. </p><p>Recently I re-found my wanting to code in Perl after reading some postings by a friend, which made me realize that I was kind of missing it. </p><p>Anywho, that brings me to the reason for this article. I am re-learning some things, and one of those things is the setting up of your own, local CPAN repository. There are times when one may not have an internet connection, but wants to work, none-the-less. This is where having a mirror of CPAN on your local machine is a good thing. </p><p>I am not going to go into how to create the mirror, because there is quite the plethora of documentation and write-ups on that topic, but instead, I am going to write a quick bit on actually pointing to your local mirror. </p><p>Now, it matters not where you have it, but for the sake of this article, let's say that you have the mirror located at /tmp/cpan_mirror (yes, I am assuming that you are on Linux. If you are on Windows, I hate to say it but you are on your own as I don't touch the thing).</p><p>The first thing you need to do is drop into the cpan cli. You can do this simply by typing <b>cpan</b> at your command line and hitting enter. You'll be dropped to the cpan prompt:</p><blockquote><p> cpan[?]> <br /></p></blockquote><p>Once there, you'll need to do the following things. I will create a list of tasks first, and then put the commands after. </p><ul style="text-align: left;"><li>check the urllist and see what other mirrors are listed</li><li>remove all other mirrors (saving the url's aside if you wish to reset them later)</li><li>add your local repo path</li><li>commit your changes</li><li>reload cpan</li></ul><p>Ok, so here are the commands:</p><blockquote><p>$ cpan (to drop into the cpan prompt)<br /> cpan[?]> o conf urllist<br /> cpan[?]> o conf urllist pop <--- run this till any urls are out of the list<br />cpan[?]> o conf urllist "file:///tmp/cpan_mirror/"<br />cpan[?]> o conf commit<br />cpan[?]> reload cpan<br /></p></blockquote><p>After that, you should be able to, at the cpan prompt or using the cli, install modules. You can test its pointing to your local repo by turning off your wifi and ensuring you cannot get to the internet.</p><p>To reset it back to internet based mirrors, just follow the same procedure, adding the mirror you like to use in place of your local path, and without the double quotes.</p><p>Enjoy! And TMTOWTDI!!</p><p> <br /></p><p> </p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-57376337374001296382023-02-07T10:11:00.000-05:002023-02-07T10:11:16.001-05:00Removing Unwanted Lines From A File<h2 style="text-align: left;">Intro <br /></h2><p> This is a bit of a "back to basics" post. I find it is good to revisit, now and then, as it keeps you sharp. It also helps as a reminder when you find yourself needing to perform this task. One never know when they need to remove lines from something like a log file. ( for say, hiding one's interactions on a server )</p><p>So, lets say you have a file ( we will call it logfile.txt) on a system, and you need to remove all the lines that contain the text foobar (I know, pretty standard, but you understand the usage). I will preface this with the fact that this is being done on Linux. And as with anything on Linux, there are a plethora of ways to do things. So long as the end result is what you require, then the method was correct, even if there are quicker or more efficient ways. These are just a couple of the quick ways that you could achieve this goal. So without further ado, let's jump right in.</p><p><b>NOTE:</b> Please keep in mind that all of these methods will achieve the same exact thing, just in different ways.</p><p><br /></p><p><br /></p><h1 style="text-align: left;">Method 1</h1><p style="text-align: left;">So the first method is more my preferred method. Why my preferred? Well, because its a one-liner and it doesn't require me to do any moving of files to different names. Its just quick and direct. But also, you need to make sure you are absolutely positive that it is doing what you expect, as it is immediately effecting of your file and not reversible.</p><p style="text-align: left;"> </p><h3 style="text-align: left;">The Method:</h3><blockquote><p style="text-align: left;">$ sed -i '/sometext/d' logfile.txt</p></blockquote><p> In the above, the '<b>-i</b>' tells sed to edit the file in place (that's what makes this a more dangerous and immediately effecting version). The /sometext/ is the text that you want to match on each line in the file. (yes, the file will be read, line by line, matching against 'sometext' to check for a match). The 'd' option says to delete that line if a match is found. '<b>logfile.txt</b>' is the file to search in. </p><p>This tends to work quick and is efficient. It would help your situation to search the file, say with grep, first, and ensure of what you will be matching. Caution is always a good thing to err on the side of, but that's just me. </p><p><br /></p><p><b>A Note Before Continuing</b>: The above method is the only immediate method I am presenting. The other two methods I show, will involve the use of temporary files. That said, they are the safer options, unless of course, you decide to script them, in which case, you make them more immediate. Your choice.</p><p><br /></p><p><br /></p><h1 style="text-align: left;">Method 2</h1><p style="text-align: left;">This method involves using grep and using the '<b>-v</b>' option, which will ignore the lines that match. It will take the lines that do NOT match, and output them to the temporary file. You will then take the temporary file, after grep runs over your file, and move it back to the original filename. Or, you could take and name it something different, the option is yours.</p><p style="text-align: left;"> </p><h3 style="text-align: left;">The Method:</h3><blockquote><p style="text-align: left;">$ grep -v "sometext" logfile.txt > tempfile && mv tempfile logfile.txt</p></blockquote><p> </p><p>Again, you could move the tempfile to another filename. Or, even better, after purging into the tempfile, rename the original file to a backup name, and then rename the tempfile to the original name.</p><p> </p><p> </p><h1 style="text-align: left;">Method 3</h1><p style="text-align: left;">This is the last method I will cover here. This involves using the awk utility. Just as the others, it will do a match, but its method is to use a '<b>!</b>', which means DON'T match, which tells awk you want to match all lines that do not contain the matching text. So any lines that do not have the 'sometext' matching text, will be output to the tempfile. </p><p style="text-align: left;"> </p><h3 style="text-align: left;">The Method:</h3><blockquote><p style="text-align: left;">$ awk '!/sometext/' logfile.txt > tempfile && mv tempfile logfile.txt</p></blockquote><p> </p><p>And as noted previously, you can rename as you wish. Either back to the original file name, or backing up the original name first, and then renaming. Its totally up to you. And also, totally scriptable.</p><p> </p><h2 style="text-align: left;">Conclusion</h2><p style="text-align: left;">I hope that this helps you manage this basic of tasks. Enjoy!</p><p style="text-align: left;"> </p><p style="text-align: left;"> <br /></p><p style="text-align: left;"><br /></p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-76389464058877053152023-01-13T21:11:00.001-05:002023-01-13T21:11:10.818-05:00Setting Up Your Own Remote Git Server<h2 style="text-align: left;">Introduction</h2><p> I don't know about anyone else, but I love having my <a href="https://github.com/" rel="nofollow" target="_blank">GitHub</a> / <a href="https://gitlab.com" rel="nofollow" target="_blank">GitLab</a> / <a href="https://bitbucket.org/" rel="nofollow" target="_blank">BitBucket</a> account, where I can store all of my code (whichever combination of those, or others you may use). But, I find it handy to have my own local, self-hosted git server, where I can store my code, until I am at a point where I want it published up to one of those other sites. Don't get me wrong, its not that I am not about sharing, but more about getting things to a usable point first. Development takes time. </p><p>Anywho, that is the 'gist' of this post..... what is involved in setting up your own, self-hosted git server, to store your code. I could also note that this is super handy if you are also a bit paranoid. Paranoia, to some degree, can be healthy. Just don't let it get out of hand. </p><p><br /></p><h2 style="text-align: left;">My Setup</h2><p>As I mentioned, I am running it on a Raspberry PI, but here are some further details on my setup:</p><div><ul><li>Raspberry Pi 3 B+</li><li>A Raspberry Pi 3 mSata SSD Shield</li><li>A 256 Gb mSata ssd stick</li><li>A 16 Gb microSD card</li><li>A 7" touch screen display (all hooked up with the pi so I don't need a separate monitor)</li></ul><div>I am using a 256 Gb drive, as I want to have enough room for whatever projects I decide to work on. Also, its expandable, so not limited to just that size. Depending on how much you plan on working on, adjust your ssd stick size. </div></div><p><br /></p><h2 style="text-align: left;">Setting Up Your Git Server</h2><h3 style="text-align: left;">Considerations</h3><div>You will need to work out where you are going to run this system. It could be a spare system (desktop or laptop).... it could be in the cloud somewhere.... or, like me, you could set it up on a Raspberry Pi on your local network. I find this handy, as its portable, should I need to take it with me on a trip, and it also uses a minute amount of power to run. No matter what, the first thing you'll need to do is work out where to run it, before you can go to the install and setup. </div><div><br /></div><div>Another consideration is, that if you are using an mSata ssd, you'll need to set it up, format it and get it setup so it mounts at boot. </div><h3 style="text-align: left;">Install the necessary software</h3><div>So the first thing you will need to do is install git on your system. This varies from system to system, so I am not going to get into that, but just make sure that git is installed.</div><div><br /></div><h3 style="text-align: left;">Setup The Git User</h3><div>If there is not a git user setup after the software install (there wasn't on my system), then you will want to do the following:</div><div></div><blockquote><div><b>sudo adduser git</b> (provide whatever password you want, but you have to set something)</div><div><b>sudo -u git -i</b></div><div><b>mkdir .ssh && chmod 700 .ssh</b></div><div><b>touch .ssh/authorized_keys && chmod 600 .ssh/authorized_keys</b></div></blockquote><h3 style="text-align: left;"> </h3><h3 style="text-align: left;">Add Developer SSH Key(s) To The Git User's authorized_keys File</h3><div></div><div>For each developer that you have using your system, you are going to have to add their public SSH key to the git users's <b>~/.ssh/authorized_keys</b> file. If you copy their key up to the <b>/tmp</b> directory, then you can do something like this, as root:<br /></div><div><br /></div><blockquote><div><b>cat /tmp/userkey.pub >> ~git/.ssh/authorized_keys</b></div></blockquote><div><br /></div><h3 style="text-align: left;">Setting Up A New Repository</h3><div>For each new repository that you wish to host on the server, you'll need to create an empty repository to host the code that developer(s) will push. You'll need to have a base directory that will house all of your repositories. For instance, I have my ssd drive mounted at <b>/data </b>on my raspberry pi, and have a directory in there called git. So I host all my repositories at <b>/data/git</b>.</div><div><br /></div><div>To setup and empty repository for your code, do the following (I will give examplease in <b>/data/git</b>, where I host mine. Feel free to change to whatever you are using):</div><div><br /></div><div><b></b></div><blockquote><div><b>cd /data/git</b></div><div><b>mkdir projectName.git</b></div><div><b>cd projectName.git</b></div><div><b>git init --bare</b></div></blockquote><div><b></b></div><div>You will see something similar to this output after the git command is run:<br /><br /></div><div><blockquote><div>Initialized empty Git repository in /srv/git/project.git/</div></blockquote></div><div><br /></div><h3 style="text-align: left;">Developer Setup To Push To Your New Repository</h3><div>Now that you have your repository created and ready to receive code, all you need to do is have your developer point at it and push their code. Here is how to point your repository at your new repo:</div><div><br /></div><div><b></b></div><blockquote><div><b>git remote add origin git@gitserver:/data/git/projectName.git</b></div><div></div></blockquote><div><br /></div><div>After they set that up, they just need to run:</div><div><br /></div><div><blockquote style="font-weight: bold;">git push origin master</blockquote><p style="font-weight: bold;"> </p><h2 style="text-align: left;">Securing Your Setup</h2><div>After you have gone through the trouble of setting up all of this, you are probably going to want to secure it, especially if you are sharing it with others.</div><div><br /></div><h3 style="text-align: left;">Change The Shell For git User</h3><div><b>NOTE:</b> Please know that once you do this, you can no longer just switch to the git user. Anything you do withing the git user home directory will need to be as the root user. So ensure you are ready to commit to this</div><div><br /></div><div>The first thing you need to do is change the shell that is used by the git user to be <b>git-shell</b>. git-shell is a special shell that comes with git, that only allows the git user to act for git related activities, and does not allow normal account shell access. This is needed, as developer's ssh keys are in the git users' authorized_keys file, and they would otherwise be able to connect as git user, to your system. This will prevent that. </div><div><br /></div><div>To change the shell for git user, run this:</div><div><br /></div><div><b></b></div><blockquote><div><b>sudo chsh git -s $(which git-shell)</b></div><div></div></blockquote><div><b><br /></b></div><h3 style="text-align: left;">Remove Port-Forwarding Ability For git User</h3><div>The second thing you need to do to secure the server, is to remove the ability of users to get port-forwarded access, which would give them access to any host that can connect to the git server. To remove this ability, you need to prepend the following text before the <b>ssh-rsa</b> portion of each and every developer key in the authorized_keys file:</div><div><br /></div><div><blockquote style="font-weight: bold;">no-port-forwarding,no-X11-forwarding,no-agent-forwarding,no-pty</blockquote><p><b> </b></p><p>After performing both of the above steps for security purposes, users will still be able to use git commands, but will be unable to get any shell on the system (or other systems). </p><p><br /></p><h2 style="text-align: left;">Some Notes</h2><div>After you put the security precautions above into place, you will not be able to become the git user in order to create the new repositories and such. If this is YOUR server, and nobody else will be on it, then you don't need to use the security precautions above, as you most likely aren't going to pwn your own data. To be honest, if you're going to share with others, it would most likely be via one of the aforementioned services and not your own, self-manage git servers. But if you do set something like this up and share with others at some point, make sure you trust them, or put the measures into place. </div><div><br /></div><div>It also worthwhile to note that scripting the repo creation and its modifications is probably a good idea. Once I get that created, I will share them in another post. </div><div><br /></div><div>You'll notice that I did not get into any GUI interfaces, like Gitea, Gitlab, etc. The reason is, I just wanted to provide guidance on setting up a plain git server for your code. As such, no gui is needed for that. If you want one of those, and decide to use one, there are a plethora of tutorials out there for installing and setting them up. </div><div><br /></div><div><br /></div><div><br /></div></div></div><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-8876808665486154202022-05-07T00:17:00.003-04:002022-05-20T22:08:13.046-04:00Thoughts On Ubuntu 22.04 (UPDATED)<p> So here I am a few days ago, sitting at my computer, working on a project, and a pop-up appears asking me that Ubuntu 22.04 had been release, asking if I wanted to upgrade to it. (Yes, I know that I can limit what I am notified of, I actually choose to know when the latest is available). </p><p>I think, "Sure, why not." and clicked through the plethora of buttons to get it up upgrade (agreeing to the upgrade no less than 3 or 4 times). So my machine goes into upgrading and I decide to let it do its thing. An hour or so later, I return and its at a login prompt, as it had rebooted. Only, the login page is now dark themed. Very nice!!! The upgrade results were starting off on a good note. </p><p>While its just a lot of packages that were upgraded, as well as the underlying software, I will say that there was an extremely annoying side-effect of this upgrade. I have some projects that I have setup, including having done pip installs of packages and such for the software. It seems that during the upgrade, all of those packages and settings went away. Seriously? Just *POOF*? What the heck, Ubuntu? Way to blow away my installs and configs. </p><p>So, I had to spend some time re-setting up the stuff I regularly used (and some I was working on). All of the items, by the way, were already using Python 3, so nothing except a newer version being installed. </p><p>I just wanted to share this annoyance, in case you are planning on upgrading. You will need to plan on some extra time, re-setting up some things once the upgrade completes.</p><p><br /></p><p>UPDATE: After some research, and noting issues seen on other machines (non-ubuntu) and work systems, this seems to be something related to a python3 upgrade. On my work Mac, it seems that Python3 upgraded, and put itself in a different location, but did not take on what was previously installed. It caused a ton of confusion in my system. There were two different versions of pip3 and two different versions of python3. It took using 'which -a' to figure this out and zero in on the issue. In the end, I had to use an alias for each on my Mac to set things right. </p><p>Here on my Ubuntu system though, the python3 upgrade simply wiped out everything that was installed with the previous python3 installation, that wasn't part of the standard library. Thanks for that. Way to seriously cause broken software that is used constantly.</p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-53309165391145776452022-04-29T17:45:00.001-04:002022-04-29T17:45:48.066-04:00So Long.... Youtube-DL<p> A couple of years ago, I decided to write a quick script called ytdl, short for 'youtube downloader'. I wrote it as a wrapper for the youtube-dl application, as I was tired of always trying to remember the options that I used when downloading either a video or a song (in audio format only) from youtube. </p><p>Recently, I revisited the application as I needed to grab a couple of things off of youtube, and found that when running it, the downloads were CRAZY slow! By CRAZY slow, I mean in the area of only getting between 25k and 50k max as a download speed. I was looking at 1-2 hours to download each of the videos I was wanting to grab. Considering in the past it would only have taken me a few minutes to download the videos I wanted (in total), I decided to use my Google Foo and see what was up. </p><p>Sure enough, it appears that:</p><p>1. youtube.com was throttling the youtube-dl application. This was confirmed by the plethora of complaints from the community that uses(used) it. </p><p>2. I discovered that youtube-dl was no longer being maintained, and that the last version (from december of last year), was the final version. </p><p>Well, that's not good. But, what is good, is that there was a replacement...... <a href="https://github.com/yt-dlp/yt-dlp">yt-dlp</a>!!! Excellent, a successor. So, I proceeded to download yt-dlp and incorporate it into my script, utterly replacing the old, useless youtube-dl. </p><p>After some tweaking to get the downloaded files the way I like them, I can happily say that I am now seeing download speeds in the megabytes!!! (7-13Mb, just on the dl's I did today). </p><p>So, I have updated all the download types in the script and pushed up a new version. If you haven't played with it, please feel free to give it a go. And, if you have any download sites that you'd like added to the script (that are supported by it), please feel free to open an issue for an improvement.</p><p>Here is a link to my <a href="https://gitlab.com/numberwhun/ytdl">ytdl</a> project. Enjoy!</p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-82007927922718857812022-04-27T18:52:00.002-04:002022-04-27T18:52:32.342-04:00Removing Tag(s) From A Git Repository<p> If you work on a team that is constantly developing their code, then you are probably dealing with at least one repository that gets periodically tagged (such as when a code release is performed). If that is the case, then you have probably (or not) had to deal with setting the tags that get applied to the repository. </p><p>If so, then you would be able to see the tags on a repository with the following command:</p><p></p><blockquote> $ git tag</blockquote><p>If you are looking for a tag, but you only know part of it, you can certainly use grep to weed through the potentially large list of tags that will be presented to you. Now, if you happen to set a tag incorrectly, or apply it to the wrong repository (or branch of that repository, for instance), you are not stuck. You can remove it. Here are the steps:</p><p></p><ol style="text-align: left;"><li>First, ensure you are in the repository in question and in the correct branch, then do a '<b>git pull</b>' to ensure you are at the latest change</li><li>Run '<b>git tag | grep <tag></b>' to get the tag name you need to remove</li><li>Run '<b>git tag -d <tag_name></b>' <--- This will remove the tag in your local repository</li><li>Run '<b>git push --delete origin <tag_name></b>' <--- This will remove the tag from the remote repo</li><li>Run '<b>git pull</b>'</li></ol><div>From here, you will need to run the '<b>git tag</b>' command in step 2 and verify that the tag has been removed locally. You can also then go up to GitHub, Gitlab, etc, and check the repository and ensure that the tag has been removed there as well. </div><p></p><p></p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-80094775749299857502022-04-13T18:54:00.002-04:002023-01-14T18:27:45.697-05:00Read Medium Articles For Free<p> There is nothing more annoying to someone who is just trying to read about something they are trying to learn about, than to have a site say, "Hey, you've reached your 'free' limit!". That is exactly what medium.com does with its articles. You need to log in to read further (so it says), and then, when you do, they STILL won't let you go any further until you pay for the right to read their articles. Call me cheap, but I believe in the freedom of information. </p><p>So, a little Google-foo and I discovered that there is a workaround for this that works in Chrome/Brave:</p><p>- Load up the article you want to read</p><p>- In the URL bar at the top, click the little padlock (the one that indicates that the site is secured)</p><p>- In there, it will tell you how many cookies there are. Click on "Cookies". It will bring up a window similar to this:</p><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTqPEJbrxyeK1RW2_ui98m3IOFmadqloumgNFpfz0fFT9wi3Qx4Xw-3-k76SzrLGBNz6xlfgZGRuB8levdE4oPQr8WORZEadfX803T1893hzUvB4bhGZmQ1n-UTCT4lUU4eS5PJghHACRKx6Yq-55yVOoldjkWLUjQEOlC7Ns_UoSGeNKcHg/s548/Screenshot%20from%202022-04-13%2018-47-45.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" data-original-height="548" data-original-width="511" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTqPEJbrxyeK1RW2_ui98m3IOFmadqloumgNFpfz0fFT9wi3Qx4Xw-3-k76SzrLGBNz6xlfgZGRuB8levdE4oPQr8WORZEadfX803T1893hzUvB4bhGZmQ1n-UTCT4lUU4eS5PJghHACRKx6Yq-55yVOoldjkWLUjQEOlC7Ns_UoSGeNKcHg/s320/Screenshot%20from%202022-04-13%2018-47-45.png" width="298" /></a></div><br /><p>- Click on 'medium.com' and click 'Block' down below, and then Done.</p><p><br />Chrome/Brave will then ask you to reload the page. Once you do, you should be able to read the article without the annoying message telling you that you haven't paid them for the privilege yet. </p><p>Enjoy! </p><p><br /></p><p>**UPDATE: I know its been quite a while since I posted this, but it is worth noting that this fix is truly only a temporary fix. I tend to browse using a VPN, and find that the fix only works for a little while. Once it runs out, I just switch to a different vpn location and voila, I can browse a little while longer. Its not perfect, but the Scottish in me doesn't want to pay for Medium at the moment. </p><p>Also, if you have this cookie block in place and you try to sign up for membership on Medium, the link they send you will hang indefinitely. You'll have to remove the block, retry the link, and things should work. Just noting. </p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-29344104991795560112022-04-10T18:03:00.000-04:002022-04-10T18:03:30.167-04:00Installing Dependencies for dpkg Software Installation<p>Let's say you download any of the plethora of '.deb' packages that exist out there, and want to install it on your Ubuntu system (or the like). You would use something similar to the following to do that installation:</p><p><span> sudo dpkg -i </span>imager_1.7.2_amd64.deb</p><p>Now, let's say you run that, but are then presented with output stating that there are a bunch of unmet dependencies. Disconcerting, sure, but its not the end of the world, for sure. For example:</p><blockquote><p>$ sudo dpkg -i imager_1.7.2_amd64.deb </p><p>Selecting previously unselected package rpi-imager.</p><p>(Reading database ... 195449 files and directories currently installed.)</p><p>Preparing to unpack imager_1.7.2_amd64.deb ...</p><p>Unpacking rpi-imager (1.7.2) ...</p><p>dpkg: dependency problems prevent configuration of rpi-imager:</p><p> rpi-imager depends on libqt5qml5 (>= 5.10.0); however:</p><p> Package libqt5qml5 is not installed.</p><p> rpi-imager depends on qml-module-qtquick2; however:</p><p> Package qml-module-qtquick2 is not installed.</p><p> rpi-imager depends on qml-module-qtquick-controls2; however:</p><p> Package qml-module-qtquick-controls2 is not installed.</p><p> rpi-imager depends on qml-module-qtquick-layouts; however:</p><p> Package qml-module-qtquick-layouts is not installed.</p><p> rpi-imager depends on qml-module-qtquick-templates2; however:</p><p> Package qml-module-qtquick-templates2 is not installed.</p><p> rpi-imager depends on qml-module-qtquick-window2; however:</p><p> Package qml-module-qtquick-window2 is not installed.</p><p> rpi-imager depends on qml-module-qtgraphicaleffects; however:</p><p> Package qml-module-qtgraphicaleffects is not installed.</p><p><br /></p><p>dpkg: error processing package rpi-imager (--install):</p><p> dependency problems - leaving unconfigured</p><p>Processing triggers for mailcap (3.69ubuntu1) ...</p><p>Processing triggers for gnome-menus (3.36.0-1ubuntu1) ...</p><p>Processing triggers for desktop-file-utils (0.26-1ubuntu2) ...</p><p>Processing triggers for hicolor-icon-theme (0.17-2) ...</p><p>Errors were encountered while processing:</p><p> rpi-imager</p></blockquote><p><br /></p><p>I know that is a lot of output, sorry about that. But I left it that way for effect and to give a full example. Now, what you will need to do in this case, is run the following:</p><p><span> </span><span> sudo apt -f install -y</span></p><p>That will take and install any dependencies that were found during the previous software installation attempt, and install them. After that is done, you can re-run the dpkg command to install your software, and it "should" just work and install your software. ( I say should in quotes, as nothing is guaranteed. )</p><p><br /></p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-7247988897823116902021-11-04T11:49:00.004-04:002021-11-04T11:49:18.262-04:00PyBlueprint update<p> Since I have started this project, I have had an issue where the "checks" option, to verify that everything was correctly installed, has been failing to detect virtualenvwrapper as installed, even though it is in the 'pip list' output. </p><p>After a bunch of digging and research, I have discovered a way to do the checks that seems to be working without issue. I have installed it on a couple of different systems, both Linux and Mac, and things seem to be functional. That is a breath of fresh air from me, as I have hated the error happening (and subsequently being ignored by me as I knew it was installed). </p><p>So what is next? I plan on adding support for more languages (shell, perl, and fix the ruby implementation to be more automated). I also want to give an option for setting up directories for code that has been checked out from a repo, so that it can be added and setup more easily than trying to remember the commands to add it. </p><p>We shall see how those options come along and hopefully I can advance this software's language support. If anyone has any requests, by all means, please leave a comment and I will see about adding to my list of items. Heck, the best way would be to open an enhancement in the repo. You can do this by creating an issue and title it as an enhancement. </p><p>Happy Geeking!</p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-58996869339380502482020-10-30T23:44:00.005-04:002020-10-30T23:44:34.544-04:00Firefox and Your Bookmarks<p> Recovering your bookmarks from firefox<br /><br />I am writing this as an alternate method of retrieving your bookmarks, other than using Firefox itself. I had an issue where the main drive in one of my servers decided it didn't want to boot anymore. I could still access the data on it via an external cable, but the system became unbootable. <br /><br />In searching, I found that Firefox stores its book marks in a file called 'places.sqlite'. That's correct, it is an sqlite database, which means bookmarks are not the only things in this file. The file is stored in ~/.mozilla/firefox/<blah>.default-release. Now, i am on Firefox 82 and my full path is: ~/.mozilla/firefox/6pcydzru.default-release. <br /><br />Now, the first thing to do is to go to that directory and copy that file to some place else (don't move it, copy it). <br /><br /> cp places.sqlite ~ <- Yes, I simply copied it to my home directory<br /><br />The reason for this is that Firefox locks this file and working around that lock is as simple as copying it to another location. And you can keep the same name, if you wish, its not an issue. <br /><br />Now, if you were to load up that file into sqlite3 and take a look, you would see that the bookmarks are certainly there, in a table called moz_bookmarks, but the urls are hashed and not readable. Here is what it looks like when I loaded it up and took a look:<br /><br /></p><blockquote>$ sqlite3 places.sqlite <br />SQLite version 3.31.1 2020-01-27 19:55:54<br />Enter ".help" for usage hints.<br />sqlite> .tables<br />moz_anno_attributes moz_historyvisits moz_meta <br />moz_annos moz_inputhistory moz_origins <br />moz_bookmarks moz_items_annos moz_places <br />moz_bookmarks_deleted moz_keywords <br />sqlite> select * from moz_bookmarks;<br />1|2||0|0||||1602647046341000|1604087203227000|root________|1|1<br />2|2||1|0|menu|||1602647046341000|1602647046960000|menu________|1|3<br />3|2||1|1|toolbar|||1602647046341000|1602647046988000|toolbar_____|1|3<br />4|2||1|2|tags|||1602647046341000|1602647046341000|tags________|1|1<br />5|2||1|3|unfiled|||1602647046341000|1604087203227000|unfiled_____|1|8<br />6|2||1|4|mobile|||1602647046545000|1602647046943000|mobile______|1|2<br />7|2||2|0|Mozilla Firefox|||1602647046960000|1602647046960000|hk7fo0BVoSNm|0|1<br />8|1|3|7|0|Help and Tutorials|||1602647046960000|1602647046960000|mtMmQ-E9oI58|0|1<br />9|1|4|7|1|Customize Firefox|||1602647046960000|1602647046960000|DrTu2wYZmIj-|0|1<br />10|1|5|7|2|Get Involved|||1602647046960000|1602647046960000|-sWrRJ5NeO8R|0|1<br />11|1|6|7|3|About Us|||1602647046960000|1602647046960000|LCI5sKvqimve|0|1<br />12|2||2|1|Ubuntu and Free Software links|||1602647046960000|1602647046960000|wvi_2QDOZLm9|0|1<br />13|1|7|12|0|Ubuntu|||1602647046960000|1602647046960000|Zfpq8U7qHTzz|0|1<br />14|1|8|12|1|Ubuntu Wiki (community-edited website)|||1602647046960000|1602647046960000|6A8e4nK1328m|0|1</blockquote><br />This isn't really usable, by any stretch, at the moment. But a little googling, and I found a site called purposeful.co.uk, whom posted a nice shell script which would do the job for you. <br />The link to this is: http://www.purposeful.co.uk/software/places2bookmarks/<br /><br />The script is on there for you to copy to your system, I am not going to repost it here. But, for readability, I will say that I modified a single line in the script. Here is the modified line:<br /><br /><blockquote>echo "$3 <A HREF=\"$url\">$title</A><br />"</blockquote><p></p><p></p><p></p><p></p><p></p><p></p><p>As you can see, I added a '<b><br /></b>' so each link would be on its own line, making things much nicer, and one entry per line.</p><p><br />Once you have the script in place (and the modification, if you so choose), you can run it like this: </p><p></p><blockquote> ./places2bookmarks.sh ./places.sqlite > bookmarks.html</blockquote><p></p><p>You will need to ensure that you replace the '<b>./</b>' with the correct path to the files, if that is incorrect. For me, I had them in the same directory<br /><br />This doesn't seem huge thing, and sure, you could use the gui, but that is not me. I prefer to do things on the command line and figure them out. Besides, I had fun doing it and learning about it, and thought I would share with everyone in case anyone else found it fun and fascinating.<br /><br />Enjoy! <br /></p><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-88847821192187662342019-02-28T14:34:00.000-05:002019-02-28T14:34:04.866-05:00Untracking files in gitIn one of my current projects, pyblueprint-py3, I have a config file. This file gets edited locally after cloning the repository, and those changes get seen by git. That is a problem. This is a file that is distributed with default values that the user edits, and git does not need to know about these changes. But, how do we tell git not to care about changes to a file? Good question, and here is the answer.<br />
<br />
For your config file (or whatever file it is that you want to prevent git from tracking), create it in your repository, and then issue the following command:<br />
<br />
<pre class="code highlight" lang="plaintext"><span class="line" id="LC4" lang="plaintext"> git update-index --skip-worktree file_name</span></pre>
<br />
The file_name should include the path if it isn't in the current directory (ie: its in a subdirectory).<br />
<br />
If the file that you don't want to track is already on git's radar, then you can do the following:<br />
<br />
<pre class="code highlight" lang="plaintext"><span class="line" id="LC10" lang="plaintext"> git rm <file_to_be_removed></file_to_be_removed></span>
<span class="line" id="LC11" lang="plaintext"> git rm -r --cached <file_to_be_removed></file_to_be_removed></span>
<span class="line" id="LC12" lang="plaintext"> git commit -m'- Cleaning up and removing file to be ignored'</span>
<span class="line" id="LC13" lang="plaintext"> git push</span></pre>
<pre class="code highlight" lang="plaintext"><span class="line" lang="plaintext">
</span></pre>
Then, add the file and edit the conf file with the generic placeholder and do this:<br />
<br />
<pre class="code highlight" lang="plaintext"> git add <new_file></new_file></pre>
<pre class="code highlight" lang="plaintext"><span class="line" id="LC17" lang="plaintext"> git update-index --skip-worktree <new_file></new_file></span>
<span class="line" id="LC18" lang="plaintext"> git commit -m'- Committing new, untracked file'</span>
<span class="line" id="LC19" lang="plaintext"> git push</span></pre>
<br />
One thing to remember, is that when someone clones your repository, before they do anything, they will need to reissue the 'git update-index' command above for the specific file you untracked. That should be noted in your documentation.<br />
<pre class="code highlight" lang="plaintext">
</pre>
<pre class="code highlight" lang="plaintext">
</pre>
<pre class="code highlight" lang="plaintext"><span class="line" id="LC20" lang="plaintext"></span>
</pre>
<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-16527162029920218042019-02-28T14:22:00.001-05:002019-02-28T14:22:43.270-05:00pyblueprint-py3 Now ExistsWhat a crazy 3/4 of a year its been. The last company I worked for kept going down hill for the employees with a ton of management change-over, which was in no way good. Eventually, things had to change and I needed to get back to a happy place. At the turn of the year I started a new job, and BOY, am I happier. While I am still ramping up at my new place of employment, I am certainly having a lot more fun here than I did the last couple years at my old job. Considering what is going on over there, I do not envy my old colleagues.<br />
<br />
Enough about the craziness. I recently sat down and took the time to convert the pyblueprint project over to using Python3. Not only that, there is a new option for specifying a language. It defaults to python, but it will create a directory structure for whatever language you choose. But, python and Ruby have support for the virtualenviroment that this project sets up (as does Go and NodeJS, but I haven't yet put together docs and such for that. That is coming though. I migrated the project to a new name, call <a href="https://gitlab.com/numberwhun/pyblueprint-py3" target="_blank">pyblueprint-py3</a>. Feel free to download it and play with it. Hopefully it works for you. If there are issues, please open a ticket in gitlab under the project. Also, I am open to feature requests, should anyone have any. <br />
<br />
Hopefully I can get more additions on to this project in the near future. <br />
<br />
<br />
<br /><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-18166463745075148412018-07-06T08:36:00.000-04:002018-07-06T08:36:33.235-04:00A new home for my projects and a project update<div>
New Home</div>
<div>
<br /></div>
I know that there is always an expectation that, if you are a developer of some sort, you store your code into Github (at least that is the first one that comes to people's mind). I have a Github acct, but, because their private repos are not free, I haven't truly used them for storing my repos. And considering that Microsoft now owns them, I really won't be using them for my code.<div>
<br /></div>
<div>
Up until now, I have relied on Bitbucket (currently owned by Atlassian), as it offers unlimited free private and public repos. We have both Bitbucket and Gitlab at my work (local installs for both). After all of the increased fanfare for Gitlab (after the Microsoft purchase of Github) and my exposuer to it at work, I have made the switch to store my repos there as well. Unless they change their policies, I will probably be with them quite a while. </div>
<div>
<br /></div>
<div>
<br /></div>
<div>
Project Update:</div>
<div>
<br /></div>
<div>
I did want to say that I have migrated my '<a href="https://gitlab.com/numberwhun/pyblueprint" target="_blank">pyblueprint</a>' project over to Gitlab. Thankfully Gitlab makes the migration to them painless, and it was just a click of a couple of buttons to get the repo moved over. The 'hard part', if you will (although not really), was fixing my git remote to point to the new repository location. </div>
<div>
<br /></div>
<div>
I do want to say that I have added support to the project for creating a repository up in Gitlab. Seeing as how I am now using it, why not. :) While testing out the application to ensure everything was still working afterwards, I discovered that my checks were not working. Why? Because the maintainers of 'pip' decided that, as of pip 10.0.0, they no longer support pip bing used programatically. If you drop into IDLE, do an 'import pip' and then do a 'dir(pip)', you will now notice that there are no methods associated (aside from the underscore methods). This completely broke my checks as I had relied on that useful bit. No worries though, the checks are fixed and functioning as expected. </div>
<div>
<br /></div>
<div>
Also, if anyone is using this application (don't know if anyone is) and they would like support for an alternative code repository, please feel free to open an enhancement ticket and I will see about adding support for it. </div>
<div>
<br /></div>
<div>
That's it for now, happy coding!</div>
<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-47345002659944776412018-06-30T12:58:00.000-04:002018-06-30T12:58:01.205-04:00Setting up MELPA for Emacs packagesIn my journey to learn emacs, one of the first things that I wanted to do was change the theme so that it was more pleasing to the eye. Anyone who uses a tool enough knows that if you can personalize it for you, you personalize it. <br />
<br />
So in researching themes ( see the <a href="https://emacsthemes.com/" target="_blank">emacs themes site</a> ), I kept seeing references to MELPA, which is an emacs package manager. Sweet! Unfortunately, my quest to install the theme I wanted was met with the fact that it is NOT configured to use MELPA by default. Thus, the reason for this write-up. <br />
<br />
In order to configure emacs to see the MELPA packages, you need to edit your .emacs file in your home directory. If you have at least opened emacs, this file should exist. If not, just create it and open it for editing.<br />
<br />
To correctly enable MELPA, you will need the following as the first section of the file:<br /><br />
<blockquote class="tr_bq">
;; load emacs 24's package system. Add MELPA repository.<br />(when (>= emacs-major-version 24)<br /> (require 'package)<br /> (add-to-list<br /> 'package-archives<br /> ;; '("melpa" . "http://stable.melpa.org/packages/") ; many packages won't show if using stable<br /> '("melpa" . "http://melpa.milkbox.net/packages/")<br /> t))</blockquote>
After you save the .emacs file, you will need to restart emacs if it is already running. If not, start it up. Once running, you will need to his what in the emacs world is referred to as M-x. On a mac, that is Option + the 'x' key. I don't run Windows, so I really couldn't begin to tell you what it is on there. <br />
<br />
That will drop you into the M-x mini buffer. There, type 'list-packages'. In the main window, a columned list should appear. The 4th column is 'archive' and should have packages that say 'melpa' (as well as 'gnu'). If so, you are good to install the theme you found. <br />
<br />
To install a melpa package, drop back into the M-x mini buffer and type 'package-install'. This will change the prompt to "Install package: " which will wait for a package name. The nice thing is that tab-complete works in emacs. So start typing a package name and hit tab, and a list will appear in the are right above the mini buffer. Once you complete installing the packages you need, go ahead and restart emacs. <br />
<br />
I certainly hope this makes your emacs package installation easier. :)<br />
<br /><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-16441091258231404302018-06-30T12:19:00.003-04:002018-06-30T12:58:23.289-04:00Straddling the line between editorsSince I started in Unix/Linux about 20 years ago, I have been a staunch user and supporter of vi. I have known plenty of people that were emacs aficionados, but haven't really taken the time to learn it to the point of being proficient. I did look at it a few years ago after starting my current job, but with all of the new things I was learning, I forwent it in favor of the things I actually needed to learn at my job.<br />
<br />
Now, 5 1/2 year later, I have decided that I am at a point where I finally have time to learn it. I know what vi lovers are thinking, "hell no!", and I get that. I was like that for years. But, after getting to work for the last 5 1/2 years with a friend that I have now known for 16 years, I have seen him operate pretty seemlessly in emacs, without needing to go to the shell that often. I have seen some pretty cool features that nicely streamlined his workflow.<br />
<br />
Its never easy picking up a new tool, that's for sure, especially when you like the features of your current tool, but sometimes you have to make concessions to go farther. All that said, don't be surprised if you see emacs related posts here, as I am wanting to share what I am learning.<br />
<br />
In closing I will provide the two initial links that I am using to start my journey down the emacs path:<br />
<br />
<a href="http://www.jesshamrick.com/2012/09/10/absolute-beginners-guide-to-emacs/" target="_blank">Absolute Beginner's Guide To Emacs</a><br />
<a href="http://ergoemacs.org/emacs/emacs.html" target="_blank">Practical Emacs Tutorial</a><br />
<br />
<br />
Hopefully, if you decide to also venture down this road, those will help you as well. I will say that so far, the Absolute Beginner's Guide has been awesome!!<br />
<br />
<br /><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-53775840040792023512018-05-05T14:01:00.000-04:002018-05-05T19:12:16.091-04:00Setup WiFi to auto-connect regardless of logged in state (UPDATED)There are plenty of times where I would like to start up my desktop machine (running Ubuntu 16.04 LTS) and just have it boot and me log into it via SSH so that I can get some work done. Well, in order to achieve that wish, you need to have your wifi connection auto-connnect at boot time.<br />
<br />
To do this, there are some things you need to do:<br />
<br />
1. Go to your wifi connection in the upper right of your screen and click on "Edit Connections".<br />
2. Once in there, you need to click on your connected wifi ssid and select "Edit".<br />
3. Go to the "General" tab and select "All users may connect to this network". (without this, the rest of this is moot and it will not work)<br />
<br />
Ok, that is the only gui portion of this setup. Next:<br />
<br />
4. Create the file /etc/wpa_supplicant.conf and add the content that follows:<br />
<br />
<blockquote class="tr_bq">
ctrl_interface=DIR=/var/run/wpa_supplicant group=wheel<br />
network={<br />
ssid="your_connection_ssid"<br />
scan_ssid=1<br />
key_mgmt=WPA-PSK<br />
psk="password"<br />
}</blockquote>
In the above code, you will input your ssid that you would like to connect to and also enter your password for the connection. If you are using an encryption method other than WPA/WPA2, then you will need to reference <a href="https://www.systutorials.com/docs/linux/man/5-wpa_supplicant.conf/" target="_blank">the man page for wpa_supplicant.conf</a>. There are plenty of examples to help you out. <br />
<br />
After you have that file all setup, save it.<br />
<br />
5. Issue the following command on the command line, as root or with sudo:<br />
<br />
<blockquote class="tr_bq">
wpa_supplicant -B -i wlp4s0 -c /etc/wpa_supplicant.conf</blockquote>
<br />
You should see a message that says something to the effect that wpa_supplicant initialization was successful.<br />
<br />
After you have completed those steps, go ahead and reboot the machine and watch the login screen. If all is correct and right with the configuration, you should see the wifi connection show as connected. You can test this by ssh'ing to the machine. Enjoy! <br />
<br />
<br />
UPDATE: I took the opportunity to reinstall my Linux system to go from Ubuntu 16.04 LTS to Ubuntu 18.04. I know its a bit extreme to do a full re-install, but:<br />
<br />
1. An distribution upgrade wasn't yet available<br />
2. There wasn't anything I couldn't re-setup on the machine<br />
3. Ubuntu moved away from Unity to the Gnome desktop, so I wanted everything clean and fresh.<br />
<br />
I will say this though, auto-connection of the wifi (seeing as how you tell it how to connect during installation) just WORKS with Ubuntu 18.04. You just have to make sure to install the openssh-server package.<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-71205360543768314832018-05-01T15:19:00.001-04:002018-05-01T15:19:37.332-04:00How to list available versions of a Pypi packageWhile working on requirements that someone had for a pypi package, I found myself needing to list out the versions of the package that were available. I didn't want to have to go to the pypi website, navigate to the package and then figure out how to see the available versions. So, to the Googles I went.<br />
<br />
In order to install a specific version of a package, you would run:<br />
<br />
<blockquote class="tr_bq">
pip install <package>=1.0.0</package></blockquote>
<br />
in order to install version 1.0.0 of said package. But, if you provide nonsense as the option, like so:<br />
<br />
<blockquote class="tr_bq">
pip install <package>=blah</package></blockquote>
<br />
then what you get back is an error listing all of the available versions for that package:<br />
<br />
<br />
<blockquote class="tr_bq">
> pip install mod_wsgi==blah<br />Collecting mod_wsgi==blah<br />Could not find a version that satisfies the requirement mod_wsgi==blah (from versions: 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.2.0, 4.2.1, 4.2.2, 4.2.3, 4.2.4, 4.2.5, 4.2.6, 4.2.7, 4.2.8, 4.3.0, 4.3.1, 4.3.2, 4.4.0, 4.4.1, 4.4.2, 4.4.3, 4.4.4, 4.4.5, 4.4.6, 4.4.7, 4.4.8, 4.4.9, 4.4.10, 4.4.11, 4.4.12, 4.4.13, 4.4.14, 4.4.15, 4.4.16, 4.4.17, 4.4.18, 4.4.19, 4.4.20, 4.4.21, 4.4.22, 4.4.23, 4.5.0, 4.5.1, 4.5.2, 4.5.3, 4.5.4, 4.5.5, 4.5.6, 4.5.7, 4.5.8, 4.5.9, 4.5.10, 4.5.11, 4.5.12, 4.5.13, 4.5.14, 4.5.15, 4.5.16, 4.5.17, 4.5.18, 4.5.19, 4.5.20, 4.5.21, 4.5.22, 4.5.23, 4.5.24, 4.6.0, 4.6.1, 4.6.2, 4.6.3, 4.6.4)<br />No matching distribution found for mod_wsgi==blah</blockquote>
<br />
Good to know its that easy. <div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-86925202457206428192018-04-29T18:50:00.000-04:002018-04-30T14:44:56.938-04:00python pip throwing SSL: TLSV1 alert (SOLUTION)<div class="tr_bq">
I recently ran into an issue with Python pip, where I attempted to run a '<b>pip install</b>' of a module and was presented with the following error:</div>
<blockquote>
> pip install pymongo<br />
Collecting pymongo<br />
Could not fetch URL https://pypi.python.org/simple/pymongo/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping<br />
Could not find a version that satisfies the requirement pymongo (from versions: )<br />
No matching distribution found for pymongo</blockquote>
<br />
No matter what I did (install, update and even just search the pip repository) I was presented with this same error. It was certainly a hard, fast stop to whatever I was attempting to do.<br />
<br />
But, after some googling and reading of many people's accounts of their trials and tribulations attempting to solve it, I finally found a solution that works. I happened upon the <a href="https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version" target="_blank">this posting on StackOverflow</a>, which leads you to the fact that you have to upgrade pip. Unfortunately, attempting to upgrade it with itself will fail as above. But, you should instead run the following:<br />
<br />
<blockquote class="tr_bq">
curl https://bootstrap.pypa.io/get-pip.py | python</blockquote>
<br />
That upgraded pip directly from the website using its install script. It is a work around, yes, but one that seems to have worked for me (and apparently others). Hopefully this solves your issue(s) as well.<br />
<br />
<b>**UPDATE</b>: You will need to run the curl command in each virtualenv environment that you have, as each one will have its own installation of python.<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-62367329240908293292017-12-16T23:02:00.000-05:002017-12-16T23:02:33.896-05:00'_remove_dead_weakref' error after upgrading to Ubuntu 17.10Well, after finally getting my Flask app running and returning data, I upgraded my system to Ubuntu 17.10 (from 17.04). Today, I tried to start my flask app and was greeted with a bunch of Python error output and the following error:<br />
<br />
<blockquote class="tr_bq">
ImportError: cannot import name '_remove_dead_weakref'</blockquote>
<br />
I was baffled as the app worked the day before. So after some digging around the Googles, I found that the issue was caused by my upgrade to 17.10.<br />
<br />
The fix....... delete your virtual environment and rebuild it. I am not saying delete your project directory, I am saying delete your envs directory (which is where the executables for the virtual environment are. Some people put it in the same directory. If you are like me, you have a central location where you keep them. <br />
<br />
You will need to remove that entire directory, rebuild it and then re-run the virtualenv command to create the virtualized environment and then install any modules that you had previously installed (as they get stored in the directory structure you just deleted. After that, your app and its parts should work fine.<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com1tag:blogger.com,1999:blog-23664930.post-64945044497466562192017-12-13T23:17:00.000-05:002017-12-13T23:17:19.989-05:00Starting Out (and pulling my hair out) with FlaskRecently I started learning the <a href="http://flask.pocoo.org/" target="_blank">Flask web framework</a>. Mostly because I have been doing a bunch of Python coding and would like that to bleed over a bit into the web development arena. The need is not really out of anything work-related, its more of a personal project need.<br />
<br />
I can say, though, that getting apache and Flask operating together has certainly added a few grey hairs to my head, mostly in frustration. There are plenty of resources ( if you search the Googles) for setting up Apache web server and Flask, to work together. But I have to say that, as great as the resources that are out there, are, there are a few (pertinent) details that were left out of most of them that I will now cover.<br />
<br />
First, working in a Virtual Environment does not have all of the same settings as not working in one. If you look at <a href="http://flask.pocoo.org/docs/0.12/deploying/mod_wsgi/#creating-a-wsgi-file" target="_blank">this link</a>, you will see (near the bottom of the document) that there are a couple of things you have to set in your .wsgi file, to specify the load paths for your virtual environment. <br />
<b>NOTE:</b> It is important to note that that link is the same root site for the Flask link above. So they definitely have a lot of documentation on their product.<br />
<br />
Now, while the above is important, it didn't solve my issue, which is that on a machine remote to where I am running my Flask app and web server, I was not able to go to http://<ip>:5000 (the port Flask runs on) and see the page displayed as expected. Instead I received a typical error page stating that the page could not be loaded. This got even more frustrating with each new thing that I tried or modified to get it working. No matter how seemingly possible of a fix, it didn't work. Until.....</ip><br />
<br />
I found a <a href="https://stackoverflow.com/questions/31870244/apache-webserver-and-flask-app" target="_blank">StackOverflow thread</a> about running a Flask app under the Apache web server. I read the person's question and went through their code (seeing all the similarities) and there it was... a setting that no other site had mentioned. Not even the video tutorial I was going through. It was part of my Flask app's __init__.py file and the part in question looks like this:<br />
<blockquote class="tr_bq">
<pre class="lang-py prettyprint prettyprinted" style="background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-size: 13px; font-stretch: inherit; font-variant-numeric: inherit; line-height: inherit; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; vertical-align: baseline; width: auto; word-wrap: normal;"><code style="border: 0px; font-family: Consolas, Menlo, Monaco, "Lucida Console", "Liberation Mono", "DejaVu Sans Mono", "Bitstream Vera Sans Mono", "Courier New", monospace, sans-serif; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline; white-space: inherit;"><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">app</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">debug </span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;"> </span><span class="kwd" style="border: 0px; color: #101094; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">True</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">
app</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">.</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">run</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">(</span><span class="pln" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">host</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">=</span><span class="str" style="border: 0px; color: #7d2727; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">'0.0.0.0'</span><span class="pun" style="border: 0px; color: #303336; font-family: inherit; font-size: inherit; font-stretch: inherit; font-style: inherit; font-variant: inherit; font-weight: inherit; line-height: inherit; margin: 0px; padding: 0px; vertical-align: baseline;">)</span></code></pre>
</blockquote>
The first line is inconsequential and just turns on debug mode. The second line was 1/2 different from mine, but crucially different. I had the app.run() that all the tutorial's had mentioned, but I did not have the host='0.0.0.0' portion. I put it in, started up Flask (by running the __init__.py file) and VOILA!!! I had the output that I expected to see in my browser. <br />
<br />
Needless to say, it was certainly a learning experience ( as I now have plenty of notes for running a Flask app with Apache). Now I can get on with my learning of the Framework since the tedious job of getting the web page serving is now out of the way. Yay!<br />
<br />
<br />
<br /><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-6079926794298733662017-03-01T21:52:00.002-05:002017-03-03T22:17:27.149-05:00I give you.... PyBlueprintAbout 3 years ago (or so), I created a bash script for starting a new Python project. I was tired of setting up each new project by hand and wanted a quicker way to do it as a time saver. That endeavor yielded a script that I have used for the last 3 years. <br />
<br />
While the script works fine from a bash perspective, I was not yet happy with it in that state. So, I embarked on re-writing it in Python. I didn't get the chance to work full force on it right away, but over the last week or so, I have made an immense amount of progress on it. So much, that I am ready to announce the project for people to download, play with and hopefully enjoy. <br />
<br />
Overview:<br />
<br />
PyBlueprint's whole purpose is to create a base project directory for new Python projects. Some of the features that the script has are:<br />
<br />
- Creates project directory for you and populates it with a base set of files (script, README, etc)<br />
- Initializes a new git repo (or not, if that is your choice)<br />
- Create a new Github or Bitbucket repository for you to push your code to<br />
<br />
I could be over estimating, but I would say that this project saves me about 5-10 minutes of initial project setup so that I can get to coding my projects quicker. <br />
<br />
I know that not everyone works in the same manner and we each have our own requirements. I just ask that if you are a python developer, please give this a shot and see if it works for you. If there are suggestions, I am open to them, please just open an issue in the project. <br />
<br />
Project Link: https://bitbucket.org/numberwhun/pyblueprint<br />
<br />
<b>UPDATE:</b> I realized a short time ago that I still had the repository set to be private. I have changed it to be a public repo. Sorry about that!<div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-77182314744165650982016-09-14T23:06:00.001-04:002016-09-14T23:06:49.713-04:00An Update On Combining PDF FilesBack on January 19th, 2009, I wrote <a href="http://www.parsedcontent.com/2009/01/easy-way-to-combine-pdf-files.html" target="_blank">a blog post</a> about combining pdf files into one. This is something I do now and again with one of my hobbies. <br />
When I wrote the aforementioned article, I was only doing this on a Linux server. Since then I have become an avid Mac user, as well as continuing my love and infatuation with Linux. On Mac, you have a plenty of the Linux utilities you are used to, but some take some searching, and even then they may not exist or be ported. <br />
In my quest to find an easy way on Mac OSx to combine PDF files, I did run across one. It is called, believe it or not, "Combine PDFs". I know, simple name, but believe me when I say that this GUI tool is pretty awesome! You simply select the files you want to combine and it then not only shows you the order it is putting the in, but it also allows you to preview each page. <br />
The tool is installed using brew on Mac. If you don't have brew, you'll have to either install it. If you don't use brew, you can always try to find it for download. But, I recommend using brew as its pretty handy for obtaining and installing software packages you need and that aren't available through the app store. <br />
If you do use brew, you can install it with the following command:<br />
<blockquote class="tr_bq">
brew install Caskroom/cask/combine-pdfs</blockquote>
After that finishes, you will see it in your applications list, as it is a GUI based application. <br />
<br />
Enjoy!<br />
<br /><div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-19095138549597428062016-09-09T11:13:00.000-04:002016-09-09T11:13:51.879-04:00Python pip Broken After Upgrade To OSx El Capitan<div class="tr_bq">
Wow its been a long time since I blogged. I have no excuse other than things have been a touch crazy. My work recently started allowing us to upgrade our Mac's from Yosemite to El Capitan. For me the upgrade only took about 45 minutes, which is pretty quick in the grand scheme of things. The download is a little over 6 gb and went pretty quickly. </div>
<br />
I was going along fine until today when I tried to install a new module using pip. About 1/2 way through the installation I was presented with the following output:<br />
<br />
<blockquote>
In file included from src/lxml/lxml.etree.c:321:<br /> src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found<br /> #include "libxml/xmlversion.h"<br /> ^<br /> 1 error generated.<br /> Compile failed: command 'cc' failed with exit status 1<br /> creating tmp<br /> cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInitf3OxN6.c -o tmp/xmlXPathInitf3OxN6.o<br /> /tmp/xmlXPathInitf3OxN6.c:1:10: fatal error: 'libxml/xpath.h' file not found<br /> #include "libxml/xpath.h"<br /> ^<br /> 1 error generated.<br /> *********************************************************************************<br /> Could not find function xmlCheckVersion in library libxml2. Is libxml2 installed?<br /> Perhaps try: xcode-select --install<br /> *********************************************************************************<br /> error: command 'cc' failed with exit status 1<br /> ----------------------------------------<br />Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-build-9IduXA/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-RgavmY-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-build-9IduXA/lxml/</blockquote>
<br />
I had installed other modules last week, but then I realized that that was prior to my upgrading. I looked at the above output and noticed the line:<br /><br />
Perhaps try: xcode-select --install<br />
<br />
OF COURSE!!! Although I upgraded, and XCode had been upgraded to, I still needed to do some things with XCode to get things going again. First, I opened XCode and went through its initial startup after an upgrade. A bunch of clicking and things were good there. I then opened up my command line and, prefixing the command with 'sudo', I ran the 'xcode-select --install' command from above. This presented me a pop-up window to install tools. So, I accepted and allowed it to install. Once finished, I tried my pip module installation again and VOILA!!!! It worked!!! <br />
<br />
So, in this lesson, always make sure to update your XCode and xcode-select before moving on after an upgrade. <div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-90822873332493032022016-02-10T11:59:00.000-05:002016-02-10T11:59:22.254-05:00Where Is All My iPhone Space???So recently my work upgraded my iPhone to an iPhone 6. In preparation for this, I plugged in my old phone and offloaded all of my photos. I made sure to delete them so the phone was cleaned off (as I always did. To my amazement though, when going into iTunes, I noticed that there was still about 2Gb of space used up by photos. <br />
<br />
I navigated over to Photos on my phone and there was nothing. I had emptied out all my stuff. I did a search and something said to turn off photo synching in iTunes. I remember I had done that a while ago, but checked it and sure enough, it was off. <br />
<br />So, a bit more digging and I discovered that apparently, there is an 'issue' (I call it that, but <a href="http://www.apple.com/" target="_blank">Apple</a> may call it a feature), where there are deleted files that are hidden and not visible, remaining on your phone. You cannot see them or find them..... so you think. Time to have some fun.<br />
<br />
If you would like to clean these hidden pictures off of your phone, do the following:<br />
<br />
- go to Settings-> General -> Date & Time<br />
- Uncheck "Set Automatically" and then set the date to August 1st, 2014 (I don't know why, its a magical date apparently.<br />
<br />
After you have done that, get out of settings and open Photos. You should now see a bunch of items in the deleted folder. Voila!! Your hidden photos that you have probably already offloaded to your laptop. <br />
<br />
I don't know why Apple hides them, but I really wish one of their developers would look at this issue and make the phone do the right thing. Our phones need space, not things we deleted taking up said space.<br />
<br />
All you need to do with the deleted items is go into the folder, touch "Select" and select all items and then click 'Delete' and they will be gone...... Space recovered. After that, go back to the Date & Time above and turn back on Set Automatically and your date should fix itself. <br />
<br />
Enjoy the added space to your phone! <div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0tag:blogger.com,1999:blog-23664930.post-18954923544785773822016-01-07T11:04:00.005-05:002016-01-07T11:05:12.986-05:00Keep Your SSH Session ALIVE!!Most of us have had those days where we have a bunch of windows open, ssh'd into multiple servers. You get caught up working on one of those servers and forget about your other ssh sessions. Or, if you are like me, you are using something like screen/tmux and have many sessions going at the same time that you want to keep alive.<br />
<br />
Well, with the default ssh setup, there is a setting in your ssh_config file called "<code>ServerAliveInterval". Initially (at least on my system) it is commented out and also has a value of zero (0). </code><br />
<br />
<code>In order to keep your sessions alive indefinitely, you will need to uncomment that variable in the ssh_config file and set it to a value other than zero. I have mine set to 60. <br /><br />What this variable does is tell ssh that it needs to send a packet across the wire to the connected server so that there is traffic, keeping the connection active, not letting it time out. </code><br />
<br />
<code>So, by to keep your sessions alive, you will need to make the changes as above, but also, do not forget that this change will only effect new connections made after you save the change. If you have active connections, you will need to exit them out and restart them. If you don't, they will still be subject to the same issue you just corrected.</code><br />
<br />
<code>Go now, keep those connections alive! </code> <div class="blogger-post-footer">Thank you for reading the ParsedContent feed!</div>Numberwhunhttp://www.blogger.com/profile/17039719920081966779noreply@blogger.com0