While setting up my vimrc for ruby development I ran into the following error:

/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `require': incompatible library version - /System/Library/Frameworks/Ruby.frame
work/Versions/2.3/usr/lib/ruby/2.3.0/universal-darwin18/stringio.bundle (LoadError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:17:in `<top (required)>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `require'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:1230:in `<module:Gem>'
        from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:116:in `<top (required)>'
        from <internal:gem_prelude>:4:in `require'
        from <internal:gem_prelude>:4:in `<internal:gem_prelude>'

This is apparently an issue with mojave and appears to be related to using the system’s ruby vs the rvm.

By adding the following to my vimrc I was able to cease the error:

let $RUBYHOME=$HOME."/.rvm/rubies/default"
set rubydll=$HOME/.rvm/rubies/default/lib/libruby.dylib

This is the first of a new collection of posts that are dedicated to reviewing tutorials I find while learning my own thing. A lot of tutorials are outdated or wrong. “You mean things on the Internet can be wrong?!” In my field I run into a lot of tutorials. Ones that are large enough to warrant a review, either being very bad or very good, I will post about. This one is about installing Laravel. Continue reading “Tutorial Review: Laravel Quick Start”

These are just basic notes for me because I will forget.

This uses the Swift-YouTube-Player Cocoapod from https://github.com/gilesvangruisen/Swift-YouTube-Player

Copy the instructions here to get it installed using pods.

It isn’t up-to-date with swift 2.0 yet so copy the changes here

Then (using the information from here) make sure the VTPlayer.html file is included in the Pods (YouTubePlayer) resources list:

  • Click on Pods ‘project’
  • Click on YouTubePlayer under TARGETS
  • Click on Build Phases
  • Click on the plus sign (add build phase)
  • Add a Copy Files build phase
  • Set Destination to Resources and add the YTPlayer.html file

Rebuild all the things.

These workflow tips are for me to remember how I managed to make certain things more efficient.

This episode started from my local neutron failing to start due to:

[code lang=text]
2015-03-16 10:56:59.272 6232 CRITICAL neutron [-] ArgsAlreadyParsedError: arguments already parsed: cannot register CLI option
[/code]

This was caused by this upstream change:

[code lang=text]
015-03-16 10:56:59.162 6232 TRACE neutron.service from neutron.openstack.common import log as logging
[/code]

I had to change all the from neutron.openstack.common import log as logging lines to from oslo_log import log as logging. This isn’t a big deal and you’d think sed would work, but it can’t work due to the difficulties involved in reordering the imports into alphabetical order.

Workflow

Using tmux I’d make a vertical split and make my edits in one of the panes. In the other pane I run:

[code lang=text]
watch -n 1 'find . -name "*.py" | xargs grep "neutron.openstack.common import log as logging"'
[/code]

Having an updating list of what files I need to update is helpful and keeps me sane.

Backstory

I really wanted to have the filename of the file I was editing to be a different color than the path of the file. Using statusline without any tricks would only provide just the filename or the full path with filename.

Solution

bufname and fnamemodify to the rescue!

Using bufname with '%' as an argument: bufname('%') will return the filename of file currently in the buffer.

Using fnamemodify with the above and the ':p:h' as escape codes will give you the entire path of the passed file and then cut off the filename.

All together it looks like: fnamemodify(bufname('%'), ':p:h')

My full statusline (with helpful comments)

[code lang=text]
" put paste info
set statusline=%#error#%{SL('HasPaste')}%*
" set color to 'search'
set statusline+=%#todo#
" if a help file or not
set statusline+=%h
" if modified or not
set statusline+=%m
" set color to 'error'
set statusline+=%#error#
" read-only or not
set statusline+=%r
" reset color
set statusline+=%*
" FILETYPE (COMMENTED OUT FOR NOW)
"set statusline+=%y\
" column number
set statusline+=\ %c,
" line/total lines
set statusline+=%l/%L
" percent of file
set statusline+=\ %P
" Move to the right align
set statusline+=%=
" put up to 50 characters of filename and path
set statusline+=\ %30.30{fnamemodify(bufname('%'),':p:h')}/
set statusline+=%#statusbold#
set statusline+=%t
" space at end to make it easier to read
set statusline+=\
[/code]

Some other tips:

To add a space you need to use: \_ where _ is actually a space.
You can define your own highlight names (seen above with #statusbold#) with:

[code lang=text]
highlight statusbold term=bold,reverse ctermfg=5 ctermbg=118 gui=bold,reverse
[/code]

I am tired of WordPress

I’m sure that sentiment is shared by more and more people every day. It is a heavyweight contender that no longer fits the leightweight blogger battles. This is my simple attempt to install something different.

The obvious benefits of Ghost, from my limited experience, have been:

  • the simple markdown editing
  • ease of installation (for people with Linux experience)
  • wonderful mobile support (mostly for tablets)

Update!!!

I primarily use the method described by [5] instead of the rest of it because it is a lot more secure.

You will still need to do a couple of the fixes listed here, but I will move them up for convenience:

  • Delete the default nginx symlink: sudo rm /etc/nginx/sites-enabled/default

Prerequisites

  • have a running Ubuntu 13.10 with root access
  • update apt-repo: sudo apt-get update
  • install the basic packages: sudo apt-get install -y build-essential

Steps to Install Ghost

  • Install the basic Ubuntu Packages required: sudo apt-get install -y nodejs [1]
  • Download the ghost package: curl -L https://ghost.org/zip/ghost-latest.zip -o ghost.zip [2]
  • Unzip the ghost package: unzip -uo ghost.zip -d ghost
  • Change into the ghost directory: cd ghost
  • Create a symlink of /usr/bin/nodejs to /usr/bin/node [3]
  • You may also need to install sqlite dev libraries: sudo apt-get install libsqlite3-dev
  • You can now run npm install --production
  • To run ghost run: npm start
  • You can modify config.js to have an external-facing IP (such as 0.0.0.0)

Steps to Deploy Ghost

  • Install nginx: sudo apt-get install nginx [4]
  • Create and edit the file: /etc/nginx/sites-available/ghost.conf
  • Enter the following into the file:

[code lang=text]
server {
listen 80;
server_name example.com;

location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:2368;
}
}
[/code]

  • Change server_name to your domain
  • Symlink your config file from sites-enabled:

[code lang=text]
sudo ln -s /etc/nginx/sites-available/ghost.conf \
/etc/nginx/sites-enabled/ghost.conf
[/code]

  • Delete the default nginx symlink: sudo rm /etc/nginx/sites-enabled/default
  • Restart nginx: sudo service nginx restart

Secure Ghost and Server

Check out this website to know how to do that.

Sources