Extending LVM storage with a new AWS EBS volume

Good afternoon. Today I had to enlarge the space on one of our servers at work. For some reason, it was set up with LVM. This is on AWS.

So some definitions for me not to forget:

  • Physical Volume – the actual drive
  • Virtual Group – a nice group of logical volumes, created from several physical volumes
  • Logical Volume – a ‘partition’ created in a Virtual Group

First, create a nice big EBS volume and attach to the AWS instance. This can be hot-plugged while the machine is up.

Create new physical volumes:

Extend the virtual group (group name “vg1” for example)

Extend logical volume to 100% free space on the virtual group

Grow the file system (in this case xfs)

Hope your server didn’t die

This step is self-explanatory.

It appears that parrots are lovely.

Bluedio Bluetooth Headphones and making them work on Windows 7

So I bought these bluetooth weird headphones from Aliexpress on 11.11, some “Bluedio Hurricane” thing. It didn’t work out of the box with Windows 7. It did work nicely with my mobile phone, which I understand is what the purpose of the headphones was meant to provide, headset fun.

Some Googling eventually provided a terrible YouTube video that the guy talks quietly and then shows an 8-bit screen-recorder of him doing bullshit in an even quieter tone. But he gives this: http://www.techspot.com/drivers/driver/file/information/15160/

Initially I thought It’s bullshit, until I got back to it and noticed it is “for non-Toshiva” laptops and that it’s a whole Bluetooth stack, so I said, oh well, I don’t have any other bluetooth devices to screw so let’s try this and screw up my whole cursed Windows.

But it worked! After installing and restarting, I let Windows beep until it realized it got bluetooth functionality again, and then I did some magic with the headphones and the ugly Toshiba device adding wizard; and I got this Bluedio magic working. I can hear you singing!

Listening up closely I realized the treble, all the high-frequencies where you have the hats and crashes of the drumkit, just sound like eagle-poop. I wanted to die, but before that, I checked the properties of the headphones inside that Toshiba lie-generator. As I suspected, there’s a sound quality setting in it. I set it up to high and disconnected/connected the bluetooth headphones (as advised) and the quality now is great. GREAT!

Making the magical terminate hung SSH session key sequence work happily

Hit <return>~.  (include the dot!).
Hard to remember? Say “tilda dot” twice out loud. It’s like saying Gal Gadot.

What? What are you talking about? Oh! A hung SSH session on my terminal!

That’s it. Most docs I found on this key sequence don’t mention that little newline before the tilda. It made me pull off some hairs in the past. I then realized the SSH terminal probably expects ~. as a single line. This means that your futile attempts to write something on the command line must put some junk before the sacred key combination.

I’ve just bought a OnePlus 3 and I think it’s ok, we’ll see in a few weeks how it goes for me and it. I just went to my appointment for being not fat and on the dark street there were lovely cats. I like cats.

One of the cats was walking across the alley and its lower body area was higher than the rest of it. I noticed that on other cats as well! Cats are funny sometimes.

So the conclusion is that everyone is stupid and don’t give you proper instructions on the net, or maybe I’m stupid for not reading the fine prints and just HOE HOW HWOE SHIE ME WALLA HERE’S KEY seQ trYY not work PULL HAIR. However, thinking a bit on how stupid and pathetic terminals are can lead you to solutions like my return tip.

Real tip

Messed up when entering your sudo password but the letters are hidden and you are sad? Hit <C-u>  and start typing afresh. Wtf happened? Try writing touch me  in the command line and hit <C-u> . Cool shit no? Good night!

Why won’t my karma js test find required local browerify modules?

In short: you wrote your nice app’s library modules that you want to test. Your project is browserified, thus included in other modules (such as the main js entry point) with a require(...). But, once you want to require them in your test suite files, karma complains it cannot find them. That’s what happened to me.

:(

After being sad and not touching the project for a week, I decided to get down to it and solve it. Looking at the test code, it hit me (and it was painful like a cat scratching you all of the sudden while you pet it). I was trying to require my to-be-tested modules in my test.js file, but how would the test file know to how to require things if it itself is not browserified??

Voila!

So I am writing some karma tests for a JavaScript frontend to a webapp of mine. I decided to go the browserify + gulp way for this project because I haven’t used those in a while. The app is small stuff, really, and it’s about time I start using test more seriously. A small-scale project is a perfect playgound for new things.

TODO: put a link to the project once the first normal version of the app is up (app up app up up up app)

Accessing your drives on Fedora using a GUI without stupid policy files

Once I was young and bold. I liked to do things with fstab, and smiled upon weird JavaScript-like looking code ‘policy files’ with whatever it is, Fedora, Gnome 3, bwaa!.

Not anymore.

So I am taking Fedora for a spin or a ride, not sure what is the correct phrase, and it started asking for passwords when trying to mount my boring Windows partitions. Searching the internet did not yield any easy results. The only thing that seemed plausible doing was creating some policy file and entering magic code that looked like JavaScript and it disgusted me. The main thought I had was “ah, yes, I will have to do that everytime I install Fedora. Search the interwebs and copy/paste the code that does this magic because if I memeorize it it’s probably gonna change between versions”. Shithorse!

Why is there no easy baboon-like-fashion to do that? Or maybe there is?

 

partition mount options

So I hit the funny Gnome shell whatever-key and wrote ‘disks’. It brought this funny dialog with all my drives and partitions. Guess what? There’s a little gear wheel that gives you other little stuff like “Edit Mount Options”. In the mount options, you can override the default magic-using auto mount settings and just do your own magic, without requiring authentication.

I even took a step further to mount the partition to a global /media/whatever folder for all of the the many users of my system to reach. Just make sure you create that mount-point first :(

As I didn’t mentioned before, this probably won’t work for USB mobile drives and stuff like that, but currently, I don’t care.

An honest, accurate review of Linux desktop environments

I use Ubuntu 14.04 at the time of this writing. I’ve been a long time user of Xubuntu, and I like it, yet I’m very open to new ideas and shit like Unity or GNOME Shell or even (god forbid) Cinnamon.

So…

UNITY IS A PIECE OF SHIT.
XFCE is almost the best thing ever.
Cinnamon can be rather interesting when customized, but it’s a piece of shit.
MATE is a piece of shit, though has an interesting smell, as if the pooper ate beetroot.
And about GNOME Shell I’m not even talking.

Unity… I installed vanilla Ubuntu the other day. I’ve tried using Unity for a few days after, but it was just too weird. Too buggy. I want my backgrounds to shuffle without ‘variety’ installed. I want my keyboard shortcuts to be easily configured without pulling my hair out of my mouth.

One day I will be an alien and use something like i3 or Awesome.

wait…

They are window managers.

OK I’m getting tired.

Gnight.

Facebook login server-side authentication because Edge and IE are crap and so is Firefox

ajajshd crap i don’t have the markdown plugin installed… ah hell, maybe later.

Greetings. I was facing an annoying multi-dimensional problem from the seventh
heaven of the universe of steel. Where I work we create a site which has (surprisingly) Facebook-based login. We use the JS SDK which is nice and does
not fully work on Edge. Mozilla also updated their amazing Firefox and the new version introduced ‘tracking protection’ to their private browsing mode among the rest. What it does is block terrible scripts from running, among them the Facebook JS SDK script.

So on Firefox’s private browsing your site won’t work and on Edge and IE it
randomly bugs out and does not complete the login process, or doesn’t fire the
popup, or god-knows and satan-eats.

## UNLESS

I saw some sites working both on Edge and on tracking protection fun. Stuff
like [bandpage.com](bandpage.com) and… err… (soundcloud.com)?
I think (a colleague showed soundcloud, I forgot it exists). I tried to look
if they have that JS SDK loaded or has anything related to Facebook JS-related
variables and they didn’t have anything interesting in the inspector. I even
used a prettifier and tried to be a hax0r to no avail.

Then it struck me! Why use piece of crap software that runs on the browser
when your $10 [DigitalOcean](digitalocean.com) server can do the
authentication before Facebook! You just show some popup with the Facebook-URL
from your language-of-choice-SDK, have your callback do the authentication
stuff with the code= Facebook gives you, and then close the popup and do
magic and you are logged in! With session variables and all for your server
to talk with Facebook.

## The idea goes like this

You clicky on a buttony. It opens a popup with the URL from your SDK, which is
on the facebook.com domain because it’s a Facebook page. When the login
finishes, Facebook redirects you to a URI on your site which will only be a
script that does *magic* and window.close(). You’re logged in.

The *magic* is letting the popup opener that we finished the login process and
that something should be done. I used a localStorage event listener
[like a guy from here suggested](http://stackoverflow.com/questions/18625733/how-do-i-get-around-window-opener-cross-domain-security)

Bad:

* window.opener – not working on Edge/IE
* thePopup.onunload = ... – Edge/IE won’t return a reference to what you
did with window.open. *sigh*
* I don’t recall anything else right now.

Good:

* Listen to a localStorage event, check for a special key change and be
happy, like reloading the page (the page that opened the Facebook popup)
or doing magic.

## Some snippets/examples

I ended up testing the idea using the example from [npm
fb](https://www.npmjs.com/package/fb), which needed some tweaking before it
worked grrrr, and writing funny code. So here are the interesting parts:

This is really ugly and hacky, it’s what creates the login button:

This is the callback view that will be shown after login in the popup:

And also this is nice for you to see, on the view that shows the login button,
you specify loginUrl with display: popup so it’s not ugly and Facebook is
not angry:

I should really go catch a train. I hope I’ll make it and get this post up on
time without too many typos.

I hope you get the idea nad I didn’t miss anything important, to summarize, do
magic on your own and leave me out and then you don’t need any FB JS SDK’s and
stuff should.

How I did Mithril server rendering for some isomorphic app stuff

Update Jan, 2017:
Quite a lot passed since this post and there seem to be some interesting projects that should be given a shot with Mithril server rendering. I’m gonna check this: https://github.com/StephanHoyer/mithril-isomorphic-example. Tell me if you find something interesting, I’d like to know!

Hello. As I was working on some web app and it started getting a bit tough for simple jQuery, I decided to try out Mithril JS rather than Reacting or whatever.

There’s this silly trend of building “isomorphic” JavaScript apps. You probably already know what it is but I’ll write one line about it: basically you make the server render the page that the browser would’ve for the happiness of SEO monkeys and performance freaks. Continue reading

Setting up local development for a Facebook app (with WAMP, but should work anywhere)

I need to develop an app (or game) on Facebook. Facebook is a pain in the pita as for developing apps. First, you have to use SSL in your app URL. Then, well, I don’t know what’s then.

As for my server’s SSL I used a StartSSL free certificate, which was also a pain in the pita to get, but I’m poor so I couldn’t afford a real-men’s certificate as of yet (hint from April’s 2016: now you can use “Let’s Encrypt”).

But how do you develop your app locally, so you don’t have to push your stuff to the server just to test your new hello world everytime? HA!

Simple. Use your hosts file. I saw this trick somewhere on the web but I can’t remember where. Maybe stackoverflow. Hmm, yeah that sounds right, smart people there. There’s also a really nice Hosts File Editor for Windows which I found useful.

So in my Facebook app’s control panel, I created a new test app for some reason, and set its URL to whatever. Let’s say https://local.monkeyballs/awesomeapp/. In your hosts file you would direct local.monkeyballs to 127.0.0.1 where your WAMP will be listening. Now you need an SSL certificate for your localhost WAMP stuff. Several guides for this around the web. I used (part of) this: http://forum.wampserver.com/read.php?2,32986

I localted the openssl command in my WAMP’s Apache folder (under bin IIRC). Then in a cmd prompt (which you can open with shift+right click in Windows Explorer, which I wrote about in a differnet article), I used:

Note I set -days to 2019 instead of 365 so the certificate will take much longer to expire.

So now you got your SSL key and certificate and you can reference them in the Apache conf. There’s also an SSL conf file, httpd-ssl or something like that under extra/. You need to pay attention to what you edit in it so it’s ultra-correct. I think the link I gave mentioned, or if not someone mentioned, that using httpd -t (the exectable of Apache) will test the configuration files, pointing out errors in a nice way. It really helped me solve some ugliness and set the SSL stuff right. Use it.

Oh! Wait! You need to enable mod_ssl in Apache! And inside httpd.conf I’m not sure with WAMP knows to uncomment the Include SSL directive. Do that.

Things to note:

  • App ID – your test app’s ID, well, it’s different from the main App ID, you should probably move this to a config JSON file or whatever.
  • Add SSL exception in browser when it complains. This makes sense, no CA signed your self-signed certificate-wannabe.

And may the Gzoo be with you. Hope this helped.

Vim, colorscheme Lucius, and terminal background going crazy (and friends)

I’ve been using the Lucius colorscheme for Vim for quite some time.  One thing had me baboon my head to the wall for quite a while.  I was scrolling down through a .c file for example, and when I scrolled back up the background colors started being ugly and didn’t fit the theme.

I googled a bit, and then I thought there might be some update to the theme file or something so I ventured forth and examined lucius.vim before updating anything.

There I’ve found lovely options to be set, and I tried the g:lucius_no_term_bg which defaults to 0.  I set it to 1 in my .vimrc section related to colorschemes and what a wonder, there’s no ugly background bug:

I have a dark-background XFCE-terminal at the moment, and functions like :LuciusWhite won’t play nicely (due to the dark backgrond of the emulator itself).  On GUI though, LuciusWhite and its friends seem to work.

Shalom.