Category Archives: My Thoughts

Intro to Cryprocurrency

This post is a bit of a quick rant on the basics of cryptocurrencies (crypto) and is just my opinions and not any advice on investing. It started as a response to someone that was interested in learning a bit of the basics of cryptocurrency. Then I got on a roll and covered a bit of ground. It does not contain many references to sources as I was working from memory of information that I have seen or heard.

Pros and Cons

One of the cons with cryptocurrencies is wading through the charlatans and hype out there. Scammers too, malware that tries to copy your crypto addresses as you cut and paste them, always visually confirm and never leak your private addresses in an unsecured environment, they are your money. hype and nonsense out there also applies to trading, investing and mining it. Lots of pros to it. But, it all really depends what you want to do with it. The options typically center around trading,investing,mining it and using it as a payment method. I’ll work through the list a bit and build my case for crypto as I move along. Mining a coin such as ETH ,is not profitable for most people at the moment, Currently electricity and equipment costs factor into this heavily. However this may change in the future as ETH will be moved from a proof of work to a proof of stake model (a bit much to explain in this intro, but if you go to the site name for the creator of Bitcoin, Nakamoto.com, there is a whole intro to cryptocurrency series of posts there), with ETH 2.0, along with other changes. Using it as a payment method is getting simpler every day, there are numerous apps for it, Cash App and Coinbase for example.  PayPal and Venmo will be integrating crypto purchases into there systems.

Fundamentals

What is going on that may cause prices to rise

People in Europe that work on the underpinnings of the banking system that allows money to move around under the hood, kind of like our ACH system here in the US are working with the folks who developed the crypto called LINK. This has leaked out, I saw the presentation where the guy giving it slipped and said the name that LINK uses in it’s code instead of the secret project name that they were using to cover up LINK’s involvement. These projects are typically secret with NDA’s and all but, human error and a slip of the tongue can happen. The US Gov’t, Treasury Dept. has hired the person that developed the stable coin called USDC for Coinbase. He worked for a bank prior to Coinbase, the name I can’t remember, but there is a picture of him with 2 other co workers that now work in the Treasury Dept. so he was most likely hired because he was the lead in developing the USDC stable coin for Coinbase. A stable coin is a coin that attempts to stay in lockstep with a fiat currency. USDC is always $1, some others ary a little bit around $1, like a range a few pennies up and down at most. Examples are Tether and DAI. On top the Gov’t reserach into an electronic coin, there was initial language in the draft for the stimulus package that was removed that reference disbursing payments using electronic coins developed by the US Gov’t. I saw copies of this, it was interesting to see a reference to an electronic coin in a gov’t doc. Also, large banks are starting to work to become custodians for crypto currencies as well, they are entering into agreements with exchanges to be the custodians of large amount of crypto. BTC futures are traded on the Chicago exchange (Chicago Mercantile Exchange), something the big boys in the investment banks are interested in. There is something called BAKKT that the investment banks are working on, I forgot the details but, it relates to cryptocurrencies Why does this matter? This is all a big pro. Because governments adopting blockchain technology, Investment banks are starting to use crypto as an investment vehicle and considering being custodians of it and integrating blockchain tech into transactions. All of this validates it’s existence, which means only more growth in the future as people (investors really and end users eventually) realize it is not some kind of fad and a toy for tech hobbyists. Remember the curve of other tech. The first home computers were also “toys” and now we can’t live without (several of them, think phones too) them, the same will happen with crypto currencies in time. As far as investing in it. A big pro is that it is a new asset class in the world. Every time a new asset class comes into being it makes for a great investment opportunity as new asset classes don’t some along often.

Cryptocurrencies as Technology

Trading and Investing

Cryptocurrencies behave a lot like a new technology in that there is an exponential growth curve which is reflected in the price. ETH could be bought for around $10 in 2016-17 and today it is worth over $300 with recent highs above $400. Weekly time-frame Ichimoku chart has a target at $750 within the next year most likely. Trading and investing are similar but, two different animals. A con with trading in general that does not occur as easy with investing is that it is easy to lose money trading for a lot of reasons, as a beginner. Most of them have less to do with proficiency and the mechanics of trading and more to do with emotional factors, especially how we view money itself. The market it a brutal but honest teacher at times and it will teach you how to look at your belief system. And, it is always your fault when you lose, the market never lies, only we can lie to ourselves. In the beginning I wish I would have spent a bit more time learning this versus spending most of my allotted learning time on technical analysis. I have found quite a few good time tested resources on the trading topic if you are interested. Always start with a few hundred $ and work up slowly until the charts stop looking like just a bunch of lines and start to intuitively make sense and your heart no longer drops every time the prices go red. It’s as if you have to develop a Zen or Taoist attitude to the market. Start with something really simple for a trading rule and stick to it. The more simple and boring the better until you get experience. And, on a longer time frame, daily and weekly charts, not less than hourly charts to start. In the limit as time –> 0 the charts become just noise which can cause confusion at best. Crypto has much more volatility than many other asset classes, so more noise there too. Especially the small cap coins, up 100% one day, down the next and as usual it takes double the gain to make up for a loss of half, so losses mount fast in downward price shocks. BTC and ETH, being large cap are less volatile than the rest, about 3000 of them, some of which are a joke (literally DOGE and Siraj coin are memes) and really have no future at all, Big pro. Investing for the long haul is one of the easiest easy options to start that can even be combined with trading/active investing. One of the best methods to invest in an asset with exponential growth is to accumulate the asset when the price is below the 1 year to 2 year average price and then distribute out at a price that is a multiple (2,3,5) of the 1-2 year moving average. Golden Ratio Multiplier Chart. This is an almost foolproof way to actively invest and could be used to dollar cost average in at the best times. Feel free to reach out to me for any more and research. I would highly recommend listening the Lex Fridman podcast where he interviews Vitalik Buterin the co-creator of ETH to get a flavor of the mind of who is behind it.

11hp Briggs and Stratton

11hp Briggs and Stratton Carburetor Adjustment

Turn needle valve (high speed) clockwise until it closes. Do not force, stop when screw closes. Now open needle valve 1 1/8 turns counterclockwise. This will permit engine to start and final adjustment can be made after engine warms up.

– FINAL ADJUSTMENT Place governor speed control in “FAST” position (that means open throttle all the way). Turn needle valve in clockwise until engine slows(lean). Then turn it out counterclockwise past the smooth operating point(rich). Now turn the needle valve to the midpoint between lean and rich. Next adjust the idle mixture. Rotate the throttle counterclockwise and hold against stop.Adjust idle speed adjusting screw to obtain 1750 RPM. Holding throttle against the stop turn idle valve in (lean) and out (rich). Set at mid point between lean and rich. Re-check idle RPM. Release throttle. If engine will not accelerate properly, the carburetor should be re-adjusted, usually to a slightly richer mixture.

Covid-19 and N-Acetyl Cysteine GLUTATHIONE

The one item of interest that I have seen lately is a case study that speaks of high oxidative stress/glutathione ratio being an indicator of poor outcome with Covid-19. This study speaks to the possibility of using NAC N-acetyl-cystine, a precursor to glutathione, it being comprised of NAC and glutamate, as a supplement to reduce oxidative stress. It also can shorten the bonds that form clotting via von Willebrand factor (VWF), a blood glycoprotein involved in hemostasis. There is a question of why not supplement with glutathione directly, as well. I know that asparagus and kombucha both contain high amounts, for food at least, of glutathione. Not sure if the body will uptake it directly or if it gets broken into the 3 amino acids and gets built back up again. With NAC/glutathione, it is also interesting to note as thrombosis has been associated with Covid-19 and of course this is a type of clotting. In my personal opinion, the links in the logic of the science with this playing a role seems plausible in theory. More studies would be required to confirm but, it is nice to see all of the effort being poured into the issue. I started down this path of research via the following videos…

https://www.youtube.com/watch?v=OtL0B1bqXak

https://www.youtube.com/watch?v=Dr_6w-WPr0w

censorship

Social Media Reform

Recently I posted a comment to this video below. What got me to post this comment besides the video itself was the censorship of Coronavirus videos on YouTube created by Dr. Seheult which thankfully are still all available on MedCram. Also I recently heard of censorship on Facebook as well.

Comment to Video

Personally I believe that major problems with social media as it is are privacy, censorship and machine learning curation of content that may include unintentional bias. I understand with machine learning many times the bias is accidental and purely based on the data going in to create the model. Another subtle potential issue with social media is manipulation, as in the manipulation of human behavior in order to create a situation in which they can be motivated to act in ways that are good and thereby profitable for the entity that owns the platform but not in a healthy behavior pattern for the individual in the long run. In my opinion humans can be subtly gamed with stimulating content curated by the platforms that can do things from as simple as encouraging more use of it to something along the lines of gently reforming a set of values that could sway a populations way of thinking over time. All institutions are capable of doing this but, social media being a unique personalized experience certainly has more power in this regard. It can be both your best friend and worst enemy. To shift forward into a new and more equitable model, in my opinion a good idea would be to redirect the funds that go from the government to the companies that run the social media platforms and fund programs at research universities to foster the development of alternative social media platforms. This would include any fines that would become levied on the social media companies for violations of the laws that will be written as a result of this executive order. The idea is to foster the development of alternative platforms that allow for a public commons on the Internet that is ideally along the lines of a self organizing system. Preferably it would not be under the control of any single entity and have transparency as far as the technology is concerned so there are no tricks up it’s sleeve, such as privacy concerns, censorship issues and unintended model/algorithm biases and unintentional human behavior modification. A model for this would be along the lines of what has been done with academic scientific research, open source software or other media such as Wikipedia, which by the nature of having many eyes on it becomes self adjusting to the needs and wants of the users, with the mechanism that achieves the results in plain sight. No doubt given enough funding and some bright minds on the task this could become a reality as the current technology required to achieve this goal is readily available.

Linux Mail From the Command Line

Local Mail Using Postfix and Mail

Mail on the command line. This was once a thing that was used much more often. When I was in college in the 1990’s it was one of the easiest ways to get mail when on campus and off. It was taught to technical and non-technical people alike as part of orientation and you were given written instructions right at registration time. Instructions came along with the email account that they made up for you using a student id number followed by @binghamton.edu. In fact, finally in the last year I was there they got rid of this cumbersome email and started allowing users to have email with their real names.

Getting to mail back then from the command line involved logging into your Unix account from one of the many terminals spread throughout the campus. Or using the  insecure but, OK at the time rlogin, remotely via dialup. Then you could either use mail or pine which was a bit more sophisticated as it was based off the pico editor, of which the popular nano editor is a derivative. It at least has somewhat of an interface that accepts up and down arrow movement and displays the shortcuts on the bottom. The standard mail program is a bit like vi, spartan but still useful.

Having access to mail locally on the command line is useful when you might be running CRON tasks or any other automated scripts that call other code as it allows you to get notified of when they have run and most importantly if they have had errors.

The other alternative is to set up ssmtp and have mail sent out of the local machine using SMTP from another established account. Of course you can also set up a full blown mail server but, that can be overkill if you are just monitoring what is happening on a few machines that you regularly log in to.

Setting up Local Mail

Below is a great Github post on how to set up local mail on a Linux Machine. I followed it and added a variation to get local mail running using the command line mail program.

It works great.  I really liked the instructions, very easy to set up. I was glad I found this as, I thought it might be tricky and with these instructions it was a few minutes on each machine.

Setup a Local Only SMTP Email Server (Linux, Unix, Mac)

 

My Additions

Server

For use with mail the program, it might not be necessary to have a local host.com in the host file. I have not tested this.

I followed the tutorial up to and including the step of restarting postfix.

Then I installed mail instead of Thunderbird.

On the server, which only has a CLI,  I wound up using mail instead of T-bird, installed via sudo apt-get install mailutils
It can be tested by sending a message to yourself by using…
mail -s “test” (your user name)@localhost

Hit enter when in the screen to bypass CC , type something and end by using Ctrl D.

Then enter the command

mail

…and you should see the email. Hit enter at the? prompt and the message is presented.

Enter q to quit.

Another test message can be sent to test if a message to any address gets sent to you. As long as the domain is local host it will work and catch it. Other domains will fall and send you an email from the system reporting the email as undeliverable.
It works great to get the CRON messages on the machine.
Just type mail and you get a CLI email list. mail basics are, q to quit, m to compose, enter and spacebar to move through messages. Entering question mark ?, brings up command help.

Desktop Install

One gotcha that caught me is that I already had T-bird installed and therefore it had a default SMTP server already. For me this required what I would call step 6A to add a local STMP server.
6A. In the pane above “Account Actions” scroll, using the bar to the bottom “Outgoing Server (SMTP)”.
Click Add
For description I wrote Local SMTP
Server Name: localhost
Port: 25
Username : (the user name)@localhost
Authentication Method: Password, transmitted insecurely
Connection Security: None

Then I went back into the account settings for the mail set up in step 6 and set the Outgoing Server (SMTP) to the Local SMTP

Host File Aliases

Also in /etc/hosts you can put in localhost.com as a alias and it works fine, like this…
127.0.0.1       localhost localhost.com

This is the way to put in aliases in a host file, for example you can have the machine name and then a shortcut to it if you have it set to a static IP. This way you can just type server to SSH to it and use that as a short name wherever you want to in scripts and etc.

192.168.1.10  Dell-Optiplex-620     server

127.0.0.1 localhost localhost.com

 

 

Habergebenen

Buttermilk Falls – Ithaca NY

Habergebenen said the GPS one day. I am spelling it just like it sounds in the GPS-speech. It was one of those nice weather days, visiting Ithaca, New York, the home of the famous Cornell University.

Besides Cornell, Ithaca is known for its many gorges and water falls. It also has a great variety of foods to offer. One good  place for food is Greenstar Food Coop, or as the GPS lady likes to call it, Greenster. So on this one particular day traveling from the west side of Cayuga lake, navigating in the general direction of Ithaca and the eventual destination of Greenstar, the GPS went off the rails. I assume it’s a software bug but, it reset, sort of in a partial reboot sort of way, out of the blue.

Habergebenen was what it said as I was not quite following it’s directions. This was new and unexpected. I heard a few other words I could recognize like rechts, which is German for right, as in “turn right “. So it was German-ish. But, not quite. Upon arrival at Greenstar, I looked at the settings and the language had set itself to Afrikaans, which is the first one in the list of many languages. I give them credit, whoever designed it thought of the whole world.

As you might have imagined by now the GPS was saying it’s typical recalculating in Afrikaans which sounds like habergebenen . It’s a word that sticks in your mind and now it’s gotten to have a bigger meaning.

Recalculating and Habergebenen

From Urban Dictionary…

A polite way of saying “you screwed up, idiot, try it again.”

A GPS says “recalculating” after you miss a turn it told you to take, then it comes up with a new route based on your current position. It doesn’t call you a dumbass, it simply says “recalculating” which lets everyone in the car know you are a dumbass without it having to actually say so.

Recalculating for me means, I walked into a room and forgot what I was in there looking for, or a general loss of a train of thought. But, habergebenen means some big recalculating as in deep rethinking of a situation that is fundamental or potentially off the rails in a great way. It happens when you have a dark night of the soul. Or the light version that shows up when you have lots of insomnia. I call it the moonlit night of the soul, as it is dim and not quite dark. It is a reboot and recalculating situation for your life and doesn’t always make sense when you are in the moment but, always does from a future vantage point.

Translations

Using Google translate, I get

Herbereken

for recalculating in Afrikaans.

In Dutch which is the root language of Afrikaans, I get

herberekenen

which is closer to what it sounds like what the GPS is says But still not what I hear in the GPS-speech.

Totally random but in Esperanto it’s

rekalkuli

which at least hints at recalculating and sounds cool too.

 

This is my first post using an iPad and it went OK. It was alright using hunt and peck on the keyboard. The word suggestions are generally helpful along with the word competition that either the iPad or the WordPress editor is handling. Next post I will try dictation out.

iPad auto complete
iPad auto complete

Buttermilk Falls

Buttermilk Falls in Ithaca, New York has a trail that runs up the gorge next to the falls and provides for some great views. In the middle of winter some times it will warm up into the 60’s. This winter 2019-2020 has been one of those very warm winters and is a good example of one that warms up nice. When it does warm up and the snow melts the falls can run pretty hard.

 

 

Cloning Linux Mint Setups

Recently I swapped in an SSD to be the new primary drive on my media center PC which was running Linux Mint 18.0 on the spinning SATA drive.

This post is basically a brief documentation of the basic steps involved in cloning or upgrading/cloning Linux Mint. Most likely this works fine for Ubuntu as well as Debian as they share a common ancestry. There are most likely limits to this scheme. I imagine things would break badly trying to do this across 17.3 and 18 for example. The base on those is a different version of Ubuntu, 14.04 vs 16.04. I might try to do a clone when the next whole number version of Mint comes along. Just pop in a drive that I don’t care about, or do it on a VM, such as Virtualbox for an experiment.

Plans

The plan is to relieve some of the storage duties of the spinning drive which was filling up. Plus a speed increase as the SSD can move data 4x faster than the spinning drive but more importantly with no moving parts the access time is minute in comparison the the spinning drive. Applications open much faster, boot time is cut by 75%, etc. If the machine needs to use swap it won’t grind down to a halt as well with a fast disk. This machine is a bit older, SATA II, but a Solid State Drive (SSD) still makes a big difference.

The idea is to clone over the home folder but exclude large data such as  the ~/Music folder and leave that on the old drive and mount the drive as additional storage and use a symlink to it.

Old Setup 160GB Spinning Drive
Old Setup: 160GB Spinning Drive
New Setup: 80GB Primary SSD
New Setup: 80GB Primary SSD

Goal

The goal of this post’s example is to  do an upgrade to Linux Mint 18.3 from 18, clone over my user settings and reinstall all programs. Over the past year and a half that the machine has been in use there have been quite a few programs that have been installed on this machine. Many of them run from the command line or are libraries related to some of the machine learning code that gets run in the background on the machine. Needless to say it would be very hard to remember them and a lot of little things would be broken.

Step 1: Install Linux Mint from USB Stick or DVD

This step is pretty basic and is covered elsewhere on the web…

Linux MintUbuntu , Debian

But needless to say you want to create a user that has the same name and User ID (UID) and Group ID (GID) as on the drive that you will be cloning from.

Step 2: Login on the new machine/drive setup kill your home directory and rsync the old one over

Mount the old drive, doing this from the GUI folder is a fine way to do it. Make note of where it mounts. You can always execute df from the command line to find where it mounted as well

It sounds crazy but, it does work. Login, open a terminal and execute…

rm -rf /home/yourusername

Everything is in memory that the OS needs right now to get through the next step, so nothing will crash and this will give you a blank slate to work with.

Next rsync over your home folder from the old drive ( /dev/sda in my case) making sure that you use the archive option. Using the v and h options as well is helpful as well to produce a lot of output in case you have to trace through a problem.

-v : verbose
-a : archive mode, archive mode allows copying files recursively and it also preserves symbolic links, file permissions, user & group ownerships and timestamps
# -h : human-readable, output numbers in a human-readable format

Example:

For me it went something like this…

rsync -avh /media/erick/B0B807B9-E4FC-499E-81AD-CDD246817F16/home/erick /home/

Next log out and then back in. Almost like magic everything should look familiar. The wallpaper on the desktop should look like whatever it was on the old setup, fonts and other desktop sizing customizations should be there. Open the browser and it should be like you left it in the old setup. It is almost like you hibernated the old setup and woke it up after teleporting it’s soul into the new drive.

But, wait the software needs attention

Step 3: Bring over the software too, sort of…

More like apt-get install it over is closer to the truth. I tried following a post on how to do this (https://askubuntu.com/questions/25633/how-to-migrate-user-settings-and-data-to-new-machine) but, what was described in it did not lead to success. The suggestion was the following…

oldmachine$ sudo dpkg --get-selections > installedsoftware
newmachine$ sudo dpkg --set-selections < installedsoftware
newmachine$ sudo apt-get --show-upgraded dselect-upgrade

It didn’t work but, it at least did the collection part. So I wound up using the first part…

oldmachine$ sudo dpkg --get-selections > installedsoftware

…and then brute forced an install by doing some grep,rev,cut,rev again on the input file. Which basically flips every line in the file and removes the word “install” which is now at the beginning and backwards then flips it back over line by line.

The next line with the awk command prepends sudo apt-get install to the front of each line and saves the output to reinstall-software.sh

 installedsoftware-to-apt-get-install.sh
 #!/bin/bash
 cat installedsoftware | grep "install" | rev | cut -c 12- | rev > cleaned-installed-software
 awk '{printf "sudo apt-get install "$0"\n"}' cleaned-installed-software > reinstall-software.sh

Run the reinstall-software.sh script and it will do just what it says, install all of the software that was on the old setup. I believe there is an option for apt-get to preanswer Yes when it comes up and asks you the yes or no question about installing. I left it off so that I could review all the larger sized software being loaded. A few times I hit no by accident so had to re-run the script, no big deal.

Reboot is best now to avoid side-effects

Before going much further a reboot is probably in order as so much has changed on the machine.

For me, during the software install process, I was presented with a question about picking LightDM or another X- windows manager. I picked LightDM because I think that is what I had been using. After I was all done, I put the machine in suspend and it had a bit of trouble coming out of it, having a temporary error related to the X-windows manager. A blue screen came up and had a message about removing a temporary file. Just rebooting the machine cleared this up as the /tmp directory is flushed. Apparently this was something that was set before the upgrade, clone and software install process and did not get unset. Other than that I have seen no side effects from the process of upgrade, clone, software install.

Other Items

If you had files configured outside of the home directory such as /etc/hosts, you will obviously have to copy that over. Also, if you have any /etc/cron.hourly,weekly,monthlies that you put on the old machine. Also, it pays to do a dump of crontab’s using crontab -l > crontab-dump.txt on the old setup so they can be reconfigured to the same settings.

Cloning old to new box

This entire process can be used to clone one computer setup to another, old box to new one for example. Which brings us to…

Final Thoughts: Twin Machines

It is entirely possible to keep two machines in sync using the methods outlined above. I have not tried this but I am tempted to test it out at least. What I am thinking of is a laptop and desktop for instance. The desktop with it’s ability to hold multiple drives with ease works nice here It has one drive with the same OS as the “twin” laptop and is setup as multi OS boot. The steps above are executed, cloning the laptop setup and data to the desktop. It is entirely possible to keep cloning the home folder contents back and forth between the two to keep them sync’d. Even the software can be kept in sync using the method used above to re-install it.

It is possible to do this directly between them, both on at the same time. Or, through a server where they both get backed up to. The only caveat is overwriting and deletions. Such as care when using the –delete option with rsync. There is a potential for a race condition of sorts if settings and files get changed and then clobbered by a sync operation. If I were to try this I would start with a one direction sync. One device is the master and the other the slave. Deletions and settings changes get cloned from master to slave automatically only.

Raspberry Pi WiFi via USB device

Setting WiFi up via the command line on Raspberry Pi, using a USB Wireless Adapter

These are notes on how to setup WiFi on the Raspberry Pi. The R-Pi is a model 2 running Raspbian 4.1.19+.

In my case and in the example that follows, the Raspberry Pi is connected to an Ethernet network, static IP at 192.168.1.17. This is the address that  I am logging in via SSH to get to the command line to configure the USB WiFi. Adapter.

USB WiFi Adapters

Two USB Wifi’s were tried a Belkin N300 and an Edimax EW7811Un. Both use the Realtek RTL8192CU chip and work well with the R-pi. Initial testing was with the Belkin and the output from this device is used in this post for the command line examples.

Edimax EW7811Un 150Mbps 11n WiFi USB Adapter, it is nano size and has a blue activity light. It works well, can’t imagine how small the antenna is in there and how they get RF to work out OK with these sub wavelength antennas!

NOTE: Originally the adapters were tried by plugging them into a powered USB hub which plugged into the R-pi. This allows for hot-plugging. If a device is hot-plugged directly into the R-Pi it will force a reboot, at least on the one that I have (R-Pi Model 2B). This is probably due to an inrush current that pulls down the power bus momentarily, I am guessing. The powered USB hub isolates the R-Pi from the devices connected to it as far as power is concerned and things will hot plug fine using it. I did realize later on that when I plugged the USB WiFi adapter directly into the R-Pi, I got more stable behavior with it. As in less strange dropouts of the WiFi from the network. It maintains a network connection better for me at least, plugged in directly.

Initial Testing

The first steps involve checking to see that the adapter is detected, registered and the correct device driver is loaded. They are just confirmation that all is well. They can be skipped and then ran later if problems arise and troubleshooting is needed.

Plug in USB WiFi adapter and run a lsusb and dmesg…

lsusb
erick@raspberrypi ~ $ lsusb
Bus 001 Device 002: ID 0424:9512 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 2101:8500 ActionStar 
Bus 001 Device 005: ID 2101:8501 ActionStar 
Bus 001 Device 006: ID 154b:005b PNY 
Bus 001 Device 008: ID 050d:2103 Belkin Components F7D2102 802.11n N300 Micro Wireless Adapter v3000 [Realtek RTL8192CU]
Bus 001 Device 007: ID 174c:1153 ASMedia Technology Inc.

The device shows up fine using lsusb. Now on to dmesg to see if the correct driver loaded…

[156238.694964] usb 1-1.3.3: new high-speed USB device number 8 using dwc_otg
[156238.797146] usb 1-1.3.3: New USB device found, idVendor=050d, idProduct=2103
[156238.797188] usb 1-1.3.3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[156238.797207] usb 1-1.3.3: Product: Belkin Wireless Adapter
[156238.797225] usb 1-1.3.3: Manufacturer: Realtek
[156238.797242] usb 1-1.3.3: SerialNumber: 00e04c000001
[156239.201673] usbcore: registered new interface driver rtl8192cu

Kernel driver rtl8192cu is loaded, all should be well with the adapter!

lsmod

The following lsmod was run and it confirms the kernel module is loaded for the 8192cu driver. It is just added confirmation that all is well.

 

erick@raspberrypi ~ $ lsmod
 Module                  Size  Used by
 xt_state                1434  1
 ipt_MASQUERADE          1220  1
 nf_nat_masquerade_ipv4     2814  1 ipt_MASQUERADE
 iptable_nat             2120  1
 nf_nat_ipv4             6162  1 iptable_nat
 nf_nat                 17132  2 nf_nat_ipv4,nf_nat_masquerade_ipv4
 8192cu                556175  0
 nfsd                  263815  11
 nf_conntrack_ipv4      14388  3
 nf_defrag_ipv4          1766  1 nf_conntrack_ipv4
 xt_conntrack            3420  1
 nf_conntrack           95316  6 nf_nat,xt_state,nf_nat_ipv4,xt_conntrack,nf_nat_masquerade_ipv4,nf_conntrack_ipv4
 iptable_filter          1698  1
 ip_tables              12362  2 iptable_filter,iptable_nat
 x_tables               18590  5 ip_tables,ipt_MASQUERADE,xt_state,xt_conntrack,iptable_filter
 i2c_dev                 6386  4
 snd_bcm2835            22502  0
 snd_pcm                92861  1 snd_bcm2835
 snd_seq                58152  0
 snd_seq_device          5142  1 snd_seq
 snd_timer              22156  2 snd_pcm,snd_seq
 snd                    67534  5 snd_bcm2835,snd_timer,snd_pcm,snd_seq,snd_seq_device
 sg                     20575  0
 i2c_bcm2708             5988  0
 bcm2835_gpiomem         3703  0
 bcm2835_rng             2207  0
 uio_pdrv_genirq         3526  0
 uio                    10078  1 uio_pdrv_genirq

 

Setup the WiFi Connection

In this example this is a WPA type of security. I know the SSID and password and just put them into the wpa_supplicant configuration file. If you need to see what WiFi nodes are available on the network consider using the scan …

( IF Needed )

sudo iwlist wlan0 scan

Check /etc/network/interfaces

Check to see that the section exists in the file that will allow the USB apapter to hot plug and also the wpa-roam line that points to the wpa_supplicant.conf file where the SSID and password will be stored in the next step.

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

…any changes to the interfaces file will require a reboot or a restart of networking to take effect, via….

 sudo service networking restart

If you are running the R-Pi headless it will disconnect from SSH and will require a re-login. If a mistake is made in the interfaces file, it might not come back and require connecting a keyboard and monitor to reconnect. The good news about having both a running eth0 and wlan0 is that if you make a mistake in only one of them it will be possible to connect via the other one. Less chances of being totally locked out by a small typo in the interfaces file. Sometimes a restart of network services will cause a non-recoverable dropout which requires a reboot to get an SSH connection going again.

Config wpa_supplicant
sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Go to the bottom of the file and add the following type of entry, putting in the correct SSID and pwd:

network={
 ssid="SprintHotspot2.4-example"
 psk="thepassword"
 }

Save and Exit

Then execute the follow to apply the new configuration….
wpa_cli -i wlan0 reconfigure

TEST IT:

ifconfig wlan0

 

Results show that the interface is up and and running

erick@raspberrypi ~/Music/music-test $ ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr 74:df:e0:e0:0e:e0  
          inet addr:192.168.128.46  Bcast:192.168.128.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4023854 errors:0 dropped:1664207 overruns:0 frame:0
          TX packets:2955774 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3003299485 (2.7 GiB)  TX bytes:1956045437 (1.8 GiB)

It should be working at this stage. Trying to reach the net using something like ping google.com should give good results. If not more troubleshooting is required. I had to do the next step to get it to reach the net on the wireless network as it was trying to use the Ethernet connection to the router to get out, set as the default gateway, which was not hooked up to the web at all. Just a router at 192.168.1.1 and no WAN port connection.

Additional Step

The following bit may or may not apply for everyone. But, I am adding here as it was not obvious at the moment I got WiFi up. I had to think on it a bit! Basically a default route has to exist that takes it to a gateway to the Internet.

IN ORDER TO GET PI OUT ON INTERNET NEEDED TO DO A

sudo route add default gw 192.168.128.1 wlan0

As there was no route out and it must pick eth0 by priority! Needs a route to the Sprint Box that I am connected to the net on the 192.168.128.0 network.

THE ABOVE WOULD HAVE TO HAPPEN ON EVERY REBOOT OR NETWORK REFRESH! Or just get rid of default gateway on ETH0 and it might just pick up the gateway on the wlan0 all of the time! If both are dhcp the eth0 gateway will always  be treated as preferred, so going static will get rid of it as I was planning on using this R-pi as a bridge from LAN to WLAN! This required editing /etc/network/interfaces to remove the 192.168.1.1 router as a gateway. The router was reconfigured by turning off DHCP on it, effectively making it an access point for WiFi. Essentially it becomes another path to the Internet along with the WiFi hotspot.

erick@raspberrypi ~ $ route -n
 Kernel IP routing table
 Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
 192.168.128.0   0.0.0.0         255.255.255.0   U     0      0        0 wlan0
 erick@raspberrypi ~ $ sudo route add default gw 192.168.128.1 wlan0
 erick@raspberrypi ~ $ route -n
 Kernel IP routing table
 Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
 0.0.0.0         192.168.128.1   0.0.0.0         UG    0      0        0 wlan0
 0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth0
 192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0
 192.168.128.0   0.0.0.0         255.255.255.0   U     0      0        0 wlan0
SHOWS UP IN /etc/resolv.conf as well….
erick@raspberrypi ~ $ cat /etc/resolv.conf
 domain router
 search router
 nameserver 192.168.128.1

 

ip show route as well…
erick@raspberrypi ~ $ ip route show
 default via 192.168.128.1 dev wlan0
 default via 192.168.1.1 dev eth0
 192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.17
 192.168.128.0/24 dev wlan0  proto kernel  scope link  src 192.168.128.46

 /etc/network/interfaces

The following /etc/network/interfaces file was edited to make the wlan0 connection which connected to the Internet work for the R-Pi.

Note the eth0 connection is setup static on the 192.168.1.0 wired network. The wlan0 connection is set for dhcp on the 192.168.128.0. The default gateway at 192.168.1.1 ( the router ) is commented out to allow the default to fall on the 192.168.128.1 WiFi router, which is a ZTE WiFi hotspot, basically a repeater from 4G LTE cell to WiFi.

Note the wpa-roam points to the wpa_supplicant file that has the SSID and password entered earlier in this post to get the WiFi going.

erick@raspberrypi ~/Music/music-test $ sudo cat /etc/network/interfaces
[sudo] password for erick: 
auto lo

iface lo inet loopback
#iface eth0 inet dhcp

iface eth0 inet static
address 192.168.1.17
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
# Remove gateway to see if it fails-over to wlan0 gateway on 192.168.128.1 12242017
# gateway 192.168.1.1
# nameservers
dns-nameservers 8.8.8.8 8.8.4.4

allow-hotplug wlan0
iface wlan0 inet manual
wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

ALL UP AND RUNNING OK

Running ip a shows all interfaces. Note that the R-pi is connected to wlan0 on the 192.168.128.46 address and eth0 is connected at 192.168.1.17, both networks are now available.

erick@raspberrypi ~ $ ip a
 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN
 link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
 inet 127.0.0.1/8 scope host lo
 valid_lft forever preferred_lft forever
 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
 link/ether b8:2a:eb:2a:a4:2a brd ff:ff:ff:ff:ff:ff
 inet 192.168.1.17/24 brd 192.168.1.255 scope global eth0
 valid_lft forever preferred_lft forever
 3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP qlen 1000
 link/ether 08:8a:3c:ba:83:8a
 brd ff:ff:ff:ff:ff:ff
 inet 192.168.128.46/24 brd 192.168.128.255 scope global wlan0
 valid_lft forever preferred_lft forever

The connection to the WiFi node can be confirmed via iwconfig wlan0…

erick@raspberrypi ~ $ iwconfig wlan0    

 IEEE 802.11bg  ESSID:"SprintHotspot2.4-example"  Nickname:"<WIFI@REALTEK>"
 Mode:Managed  Frequency:2.452 GHz  Access Point: 34:3A:87:3A:BA:3A
 Bit Rate:54 Mb/s   Sensitivity:0/0
 Retry:off   RTS thr:off   Fragment thr:off
 Power Management:off
 Link Quality=100/100  Signal level=63/100  Noise level=0/100
 Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
 Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.

eth0      no wireless extensions.

 

Miscanthus giganteus

I recently saw a stand of Miscanthus giganteus at Cutler Gardens in Binghamton,NY. It is an impressive grass standing at 10-11 feet tall. I am thinking of ordering some rhizomes to grow some. It would make a nice natural privacy fence. It sure looks cool too, even when it dies off it still stands nice and tall. I imagine the snow will eventually knock it over in the winter. When I saw it, I looked it up on the little pamphlets available at the gardens and of course on Wikipedia. https://en.wikipedia.org/wiki/Miscanthus_giganteus
Who would have know that it can be actually used as a biofuel! What an interesting plant and it is a so called C4 plant as well just like corn, it can more efficiency convert water and CO2, via photosynthesis into plant material, giving it an edge in creating biomass.

I found a place to order the rhizomes too…

http://www.mapleriverfarms.com/index.php