I want to try to redo my website, moving to css grid. I’m also unsure about whether I want to keep wordpress. I’d like to use flask or django. I had built a Rails version, but don’t think I like it enough. That project had a calendar on it that I could copy and paste tech event urls from EventBrite, and it would automatically grab and display relevant information about the event. Back then I was thinking to do a tech calendar for Miami, since a lot of us are hoping to see the tech industry grow here.

Using systemctl to control a uwsgi systemd service in ubuntu

Disclaimer: These docs are not intended to be a tutorial. They are intended to be informative. I know it might be kind of hard to understand. I wanted to keep it short enough to get through. I would definitely like to add some clarification and roadmap stuff to it later.

I built a webapp which is associated with a phone number I own. I call it BulletxtBoard (you can see it at Any text received to that phone number is displayed on that page in real time.

The webapp initially receives requests through nginx. The request is passed through a uwsgi socket (this is specified in an nginx config file, see below). A socket is essentially a unix file that can receive data. The socket is located inside of my flask Bulletxt app directory.

location / {

include uwsgi_params;
uwsgi_pass unix:/var/www/mwise/;


In addition to this, I need to define a uwsgi service that is managed by systemd. This service is defined in /etc/systemd/system/duffys.bulletxt.service. The service is started using the command

systemctl start duffys.bulletxt

Notice I didn’t include the .service suffix. It is not necessary, as systemctl assumes it is a service when it sees you using “start”.

systemctl restart duffys.bulletxt acts to restart it

systemctl status duffys.bulletxt shows useful information about the service.

journalctl duffys.bulletxt shows a log for the service.

Anyway, back to the details…

The uwsgi service file is pretty succinctly cool. It’s mostly intuitive.
(reminder, it’s in /etc/systemd/system/duffys.bulletxt)

Description=uwsgi instance serving duffys.bulletxt flask app.

ExecStart=/var/www/users/ –ini uwsgi-bulletxt.ini


The User and Group to be run as is specified (www-data). I won’t get into [Unit] and [Install] here.

The WorkingDirectory is the location of my app.
The Environment is the python virtual environment I want to use to run it. (Remember virtual environments are good practice so your python projects can have their own exclusive python directory that won’t get mucked up when you’re working on other projects.)
The ExecStart is the entry (starting) point for the app. Notice there is an ini flag. It’s important.

The ini looks like this:

module = uwsgi-bulletxtboard:application

master = true
processes = 5

socket = /var/www/mwise/
chmod-socket = 660
vacuum = true

die-on-term = true
logto = /var/log/uwsgi/%n.log

Notice that the ini file lives within the working directory we specified for the app (look at WorkingDirectory listed in the systemd service file). And this ini file is referenced as part of the EntryPoint you saw a second ago. The app is actually the entry point, and the uwsgi ini indicates the app here module uwsgi-bulletxtboard:application.

So, uwsgi will search for a file called also in the working directory. It looks like this:

import sys
import logging

from bulletxtboard import app as application
application.secret_key = ‘obscured’
if __name__== “__main__”:

This python file merely adds the working directory to the paths available from within python, and then imports the main flask app file (which actually contains my app BulletxtBoard).

Note looking back, I’m thinking I shouldn’t have that shebang (since I should be using my python virtual env). I’ll have to test that another time–it’s late.

Lazy Eye

Silversun Pickups’s Lazy Eye came on spotify radio and got me thinking about the oddness of that song. It hit #5 on Billboard back in 2006. Anyone will agree the sound of Silversun Pickups is very grunge, almost straightup pulled out of the 90’s. For it to make it to #5 is pretty cool. Otherwise we’ve seen a departure from the melodic and slower tunes of 90’s and early 2000. So the song is a bit of an anomaly, and it’s success makes me ponder if there had been a couple other peaking bands of that style, maybe we’d have more of it nowadays. I feel like there is a grungy/chill gap in music.

Blasting off into space–cheaper and cheaper.

In about 10 years, SpaceX one-upped the whole space industry with the Falcon 9 with launches $100M. They’ve brought that price down to $60M recently. And if you’re cool with sending your load up on a previously-flown booster, they’ll get you down in the ballpark of $40M. These last bits are within the last year.

Very glad SpaceX narrowly evaded demise in their early days. To wit, SpaceX is a great example of how one player can push the course of civilization in better ways.

[More Reading from March 2017]

Anisotropy or bust

I sometimes think about the Lawrence Krauss quote.

“But when you look at CMB map, you also see that the structure that is observed, is infact, in a weird way, correlated with the plane of the earth around the sun. Is this Copernicus coming back to haunt us? That’s crazy. We’re looking out at the whole universe. There’s no way there should be a correlation of structure with our motion of the earth around the sun — the plane of the earth around the sun — the ecliptic. That would say we are truly the center of the universe.”

I’ve been doing some further lookin’s into the cosmological anisotropy. Very coincidental. And a question of which the answer may have to wait very long to be heard. Curious whether it will be beyond a typical human lifetime. I have fair faith in the progression of technology. Technology will help solidify our grasp on the physics we know as detection betters. Perhaps some clever experiments and good tech will press out an absolute book of physics. Maybe it will be enough to be bolster confidence in our universe. Finding out absolutely that we are the center or otherwise. Yet I exclaim and ponder, perhaps we’re in a situation where this grand anisotropy can’t be answered without going somewhere else. And that can take time.

Oh back to my title, someday I want an “Anisotropy or Bust” bumper sticker, as homage to Richard Feynman’s unfulfilled “Tuva or Bust” bumper sticker.

And a random funny:


python print formatting

I hadn’t appreciated messing with python string formatting until today. Before I thought it was kind of tacky, but I’m starting to develop an eye for the syntax and appreciate it in a pretty way.

This defining moment was when looking over this guide. The section I linked shows that you can pass dictionaries and even objects to python’s .format(). Basically, any object that has the methods __getitem__ and __getattr__ defined correctly.

If I include an example, you probably won’t check out the page I linked, and the page I linked is well written.

So that part’s cool. But on another note, I can’t think of any examples where you’d want to override the __format__ magic method as seen here.

just websockets

Been working on a cryptotrader for poloniex exchange on and off. Was using autobahn wamp to do the websocket conn but hated it because of all the overhead. Couldn’t tell what was going on. Wanted a more granular approach to doing a websocket so I could troubleshoot connection problems more intimately. Finally found that I can just use the python websocket lib. So much simpler and assured.

Gotta check to see how the received data compares to recdata from my past implementation. Should be the same. Hopefully no work to be done to fit it into my db.

Some pudding

2018-01-06 12_04_01-Fade Lens


I’ve been using byobu. I fell in love quickly. Those people did a great job. It tabifies your terminal, and even lets you split your tabs into quadrants and such. Ships with ubuntu. Simply type byobu and it overhauls your terminal.

F1 is your best friend. It makes a quick yet spacious overlay where the first entry show keyboard shortcuts. Smash escape a few times to exit help and get back to business.

F2 opens a new tab. Alt+Left or Right switches between those tabs. Merely type exit to close a tab (there are keystrokes for closing too). Ctrl F2 for vertical split or Shift F2 for horizontal split. Focus between those splits using shift arrow-keys.

F7 locks the currently focused terminal/pane and let’s you Up/Down arrow key through previous output. Pressing q exits that mode and brings you back to the latest output, where the arrow key cycles input commands.

That much Byobu knowledge will keep you coming back to it. Other functionality is icing on the super tasty cake.

Also, I’ve been using vim a lot. Vim is a majestic castle.

Getting wordpress back up with nginx

This entry is not fully descriptive, and is mainly to exercise memory. Don’t use it as a guide. It is vague and will frustrate you.

I switched to Nginx on my main server a couple months ago, along with a slew of security upgrades Andrew Duty performed for me. This is all in preparation of deploying a product I built which allows real-time sms to be displayed on a website.

Well, I got served through nginx but never tied up the lose end of this wordpress. For one, I haven’t rolled with wordpress+nginx before.

Well I went through and got it working. In the process, I put proper permissions on all wordpress files–which can be found here. Namely, directories get 750, files 644, and wp-config.php 400. Before they were 777 (jk! 777 is scary). For that, I used a nice pairing of two commands–find and chmod:
find . -type d -exec chmod 750 {}  ./;
and for files
find . -type f -exec chmod 644 {} ./;
Pretty cool. Very effective.

Don’t forget to hit this guy last.
chmod 400 wp-conif.php

As part of Ubuntu 16 I’ve been using systemctl.

Restart nginx service:
systemctl restart nginx

View log about recent services failing to start:
journalctl -xe

Note that journalctl will let you know about nginx fails. And other deeper problems may be in your /var/log/nginx/. For that you can:
tail -f /var/log/nginx/error.log.

I had to do some changes to this site’s nginx config. Particularly, I added a location block which points to my wordpress directory, declares the index attribute, and within that block declares a block for php files, and points to my freshly updated php socket.

Reckless Abandon within the World Wide Web (Part 1)

Many coders will end up on all sorts of Stack Exchange sites–whether through need or curiosity. I’ve registered on a couple of stacks. And I still come across questions on stacks I want to favorite, but I’ve yet to register on.


It stirred me slightly. I mean, who hasn’t pent up some aggression towards Stack before ;)?

My issues:

  1. This ‘favorite’ may be the only star I have at stats.StackExchange for some time.
  2. I didn’t remember if it was a quick process to add another stack.
  3. There’s a slight psychological burden. Namely “Ughhhhh I have to register yet another account on the interwebs. Another account to have dangling in the furthest recess of my mind.”

With fairness, it turned out to be an easy 15 seconds to add this stack to my account. Yet, I’m here writing for something bigger. I want to document and formalize my thoughts of web inefficiencies we all deal with, and maybe build up a grander case over time. The world may never be perfect–yet there is nothing damning us from a more perfect world other than our obstinateness of the idea that we shouldn’t strive for it.

For that Stack issue:

a) Just star the question when I click on it, flashing that the Stats Stack has been added to my accounts with an undo button.
b) Or better yet, decouple favorites from specific Stacks and just add them to a list in my main Stack account.

You may argue these things are often not trivial to change. That the complexity of changing it isn’t worth the benefits of the change. Maybe. But what I’ve noticed in my advent into the coding world is that changing or adding things is too frequently overly stressful and difficult. I think this is because we often don’t code in modular blocks. What we’re tossed into doesn’t help us code in modular blocks. We just want to get the job done. This leads to the really big picture I’ve been troubled about.

We spend too much time using our tools instead of developing our tools. Heck, even the best coding tools we possess either have a learning curve || significant setup cost || cost money. Even our terminals and IDEs–everything we build becomes so specialized that it’s hard to contribute any component without knowing the whole thing well, or requiring an infeasible amount of time of the core developers. Our tools should encourage us to plan and organize. To track what effects there will be. To warn us. And we shouldn’t have to do/master all of those things on an individual basis. We shouldn’t have to be experts in a development environments. Our environments should guide more intuitively. I don’t know what that solution looks like, but we’re smart people who spend a lot of time doing the same things–debugging and tiptoeing.

There is certainly no solution without garnering a bandwagon. No bandwagon here. Just a spoke for now.

Footnote: aye my site is quite neglected by expectation of few visitors. If you are here, please pardon this. When the time is good, the site will be redone.