Search Results: "ghostbar"

14 May 2014

Jose Luis Rivas: transloadit-api v1.0.0-rc1

A release candidate for v1.0.0 of transloadit-api is out. You can install it via npm and give it a try.
npm install transloadit-api@1.0.0-rc1
Now it supports the full transloadit API, together with signature's creation, assemblies, notifications and templates management. The source is on github, the docs are in this website as well as in the comments in the code (which is the source for the website) and of course, any issue just report it on the github's tracker. It has a lot of tests but there are some tests missing, specially for operations that require internet. Hopefully I will have time to write them this week and then release a proper v1.0.0.

13 May 2014

Jose Luis Rivas: angular-geocomplete's first version

So I was needing a resulting JSON array with possible solutions for a given address or city name and then angular-geocomplete was made. The great thing is that you can use it together with typeahead and now you have address/location autocomplete, just like the one on Google Maps. And yes, it does uses Google Maps's API. What's the advantage of this thing? You get coordinates together with all the names. Installable via bower as well with bower install angular-geocomplete. Any issue: to the GitHub tracker.

26 August 2013

Jose Luis Rivas: MongoDB: $pull from an embedded document array

TL;DR: db.collection.update( _id: 'x' , $pull: embedded_doc: _id: 'y' ) Queries are wrote for the mongo shell Dot based access If you have been using MongoDB for some time, then there are big chances that you will know the "dot-based access" on the find queries. This is the easier way to write those queries and will probably want to keep using that. Like:
db.collection.find( _id: 'x', 'embedded_doc._id': 'y' )
The thing is that does not work with everything, like: Arrays of embedded documents! Little example schema Let's suppose the following little schema (written for Mongoose): A = new Schema( w: String, x: String ); Document = new Schema( embedded_doc: [A] ); The collection of Document is called documents. Updating arrays If the arrays are not embedded documents I can actually just use a regular update like with any other field combined with a $set and change all the array like:
db.documents.update( _id: 'x',  $set:  array: [
   a: 1 , 
   a: 2 , 
   a: 3 
] )
And using conveniently $pull and $addToSet. But when it comes to embedded documents the history is very different. You can't make a simple $set because it will give you an error related to ModId which you can't change. So you really need to use $push, $addToSet, $pull and it's friends. So all those you can do it as in the manual, but what if you want to make a $pull over an array of objects and w and x are not unique? Well, that's why you probably made them an embedded document! Then you have the _id and you try to use the dot notation like:
db.documents.update( _id: 'x' ,  $pull:  "embedded_doc._id": 'y' )
And it looks good, except that it wont work. You have to use the complete syntax like:
db.documents.update( _id: 'x' ,  $pull:  embedded_doc:  _id: 'y' )

23 August 2013

Jose Luis Rivas: Too many authentication failures on SSH

It seems like having several SSH keys on the same system starts giving issues with some SSH servers. The issue is that while connecting it returns: Too many authentication failures for xxxxxx. The fix for this is very simple and quick. Open up your ~/.ssh/config and put: IdentitiesOnly yes You can add that per-host or wide (without indents, even as the first line in the config file!).

22 August 2013

Jose Luis Rivas: Starting a Raspbery Pi without a display

Recently (actually 3 weeks ago) I bought a Raspberry Pi for myself and it wasn't until today that I power it on by the first time. Call it RealLife for simplicity. Anyway, one of my first issues was that I do not own any display with RCA or HDMI inputs, and all I have is a router that works as my WiFi hotspot as well. Since this starter kit comes with Raspbian by default I made some research and found that the default user:password is pi:raspberry, ssh-server is on by default and the network interface eth0 tries to grab an IP automatically via DHCP. So starting my Raspberry Pi was as easy as connect a wire to my device and the router, then a quick nmap -sP 192.168.0.0/24 and there it was, under the hostname raspberry my brand new raspberry. After a ssh pi@192.168.0.X a nice raspi-conf was receiving me to start setting up my device.

27 January 2013

Jose Luis Rivas: Less Swap

My old X61 has 2G in RAM and 3G in Swap. It seems my using-habit for Google Chrome is heavy (more than 20 tabs open most of the time) so my swap is normally being used above the 1.8G-mark. That means, my disk is constantly being written and read, and since this is the original hard-drive scare comes to my mind: will I blow-up my disk if I continue doing this? and the heat this disk-use's generating was absurd. That's not good, at all, I prefer having cache used than swap; in Venezuela is not that easy to get a good sale on hard-drives (you know, is hard to get dollars here, since is illegal to buy them unless the govt gives you permission). So the first thing that comes to my mind is sysctl. If I wanted to cofigure swap it would be with a kernel parameter. So running sysctl -a grep swap throws me vm.swappiness = 60, and a little google search tells me more about it. If the swappiness is close to 0 then it will use the swap only if it is really necessary, if it is close to 100 then it will use the swap aggressively. Mine was at 60, and it was really aggressive. The next steps for me was doing sudo echo 'vm.swappiness = 1' >> /etc/sysctl.conf && sudo sysctl -p. Now my system is really smooth and using Chrome + Terminal + Tmux + Rhythmbox is acceptable.

15 December 2012

Jose Luis Rivas: Switched to Jekyll

After long-time without updating my blog, I decided to give it life again, but this time I wanted it to look different and started to make a new theme. Remembering the good-bad old days with WordPress was not an option, so I started prototyping right away with jekyll and things were fast, considering my 30-minutes a day approach since 3 days ago. Of course, is yet a work-in-progress, and in the meantime I wrote 320Stylus so things could came up faster working mobile-first. But I will write more about that later.

Jose Luis Rivas: Why Jekyll

Why? I switched to Jekyll but it wasn't a fast decision. I really tried to give WordPress a chance, again, but I'm not getting along pretty well with PHP since like 2 years ago. In fact, is a headache to maintain on my server. In the course of the years I have had several downtimes on my PHP-based sites because of changes like PHP-FPM. Some sites just dropped working for me while others kept doing OK. This is in the same server, with the same database and the same codebase (WordPress). After a lot of time programming on Node.js and been learning more Ruby (CoffeeScript made me love the syntax) I just got tired of using more resources of what I really needed, and with a regular CMS that means a database. Why would I need a database if I just update like once a day? For a comment-system? There's Disqus already, and people can just comment you on Twitter or make a Branch for it, or just write you an email! Plain simple. Jekyll So there was Jekyll, a pretty nice tool creating static-sites very fast and easy to learn. It didn't needed a database and because all is static is pretty fast. Even the hosting requirements got lowered to the point I could (and I did) just upload this to GitHub and served it from there as a GitHub Page! One more thing One thing made me decided to upload to GitHub as well was Prose.io, a simple text-editor for GitHub with support for MarkDown made by the guys @ developmentseed.com. So while it was made for being updated on my terminal I could just do it as well from the web, from anywhere with just my GitHub account and having previews on-the-fly. The downside Since I don't control this server I couldn't setup redirections for my old feeds. Of course, I could have just copied the same pattern in a folder and put there an XML feeding the category X, but I think is easier to update the planets being feeded to the new URIs. On the bright-side I even could put pretty-permalinks to work! So the structure for my old links kept the same.

2 September 2012

Jose Luis Rivas Contreras: Finally a workaround for htop drawing issue inside tmux!

I was tired that htop didn t showed up the info as is, and started to google about it. Aparently there s an issue with the drawing stuff for bold and not-bold fonts, and most workarounds consists on making htop showing things on black and white. Then, lazyness came to my mind and used:
TERM=screen htop
Wala! It worked, and showed htop with colors! 12 colors of course, but I don t need more!! So after that I just echoed that line to my ~/.bash_aliases and is pretty much done for a while, at least for me. It works!

30 June 2012

Jose Luis Rivas Contreras: Newer Node.js + NPM installed separately, execvp() error

I got an awfull bug with npm after installing Node.js 0.8.0 and trying to do an npm -g update. The solution was deleting npm from /usr/local and with nave reinstall 0.8.0. After this my npm was working perfectly but that made me loose like 12 hours. (I thought was a bug in an app I m writing, I totally forgot I ran npm -g update.)

3 June 2012

Jose Luis Rivas Contreras: Little CoffeeScript to resize images

I needed to resize about 300 images and couldn t find an easier way to do this than with help of node + CoffeeScript. So here s my script, it requires you to install (via npm) imagemagick and underscore: <script src="https://gist.github.com/2862235.js?file=resize.coffee"></script> Grab it if you want, is under Do Whatever You Want license. As you can see from the shebang (that s the first line of the script, with the #!) I ran it from my command-line, this was not used in a website, although it could without too much modifications (the magic of JavaScript).

28 April 2012

Jose Luis Rivas Contreras: Tracker eating my memory cache

UPDATE I removed tracker, when I rebooted my machine again my memory cache got ~1000M again, and again, and again. I didn t knew it existed until recently, that I saw all my memory was eaten up and suddenly I was using my SWAP instead of my memory, and it was fully loaded. What s my surprise? I have 2G in memory and 1113M of it was cache, and 1G of swap full as well. The worst thing is that I reboot my machine and without starting anything I get 903M of cache full, out of nowhere! I start to track what s the issue, where s the leak, and found that if I killed tracker-store early then my memory stopped being loaded of cache. There s a bug, already reported, it s #612242 and the workaround given is to nuke the database with tracker-control -r. It worked. Now my cache is not full, but since I just did it I don t know if in some days my tracker-cache will be full again and eating all my memory. Just wanted people know there was a work-around at least and you could use your computer again.

12 February 2012

Jose Luis Rivas Contreras: Express Sessions with connect-redis + Socket.IO in CoffeeScript

If you are working with Socket.IO and Express Framework while developing your applications you must know they work together so Socket.IO will listen on the same port that your HTTP/S server and will serve the requests by that way, but Socket.IO doesn t works on the same paradigm where you pass a middleware to the route and you could get authentication on this manner. Instead, you must configure Socket.IO with a global authorization method or a handshake authorization manner. Since in my applications I serve cookies already where I save session info and this is already stored in Redis with help of the module connect-redis then I should be able to get this info onto Socket.IO authorization method and with this allow only to authorized users to get info from my websockets. I found how to do it with the default session-store in-memory from Express, and adapted that so it could work with Redis. Here s the snippet: <script src="https://gist.github.com/1805743.js"> </script><noscript>You don t have JavaScript enabled, check it out at gist.github.com </noscript> Hope anyone can found it useful!

5 November 2011

Jose Luis Rivas Contreras: Polipo and uncachable file

Dear lazyweb, I was searching through the internet what was I doing wrong, I wrote to the polipo-user list but my email got stuck on moderation, and my connection is really shitty (that s why I m using polipo the way I m using it). I have relaxTransparency and mindlesslyCacheVary set to true, but I don t need so aggresive caching in my development stages that are located under *.local and another development subdomain on the net. Already tried setting uncachableFile to /etc/polipo/uncachable and to ~/.polipo-uncachable, according to the web-config thing is properly setted up, but can t get it to recognize it s content. I first thought it was I was writing bad the regex, .*\.local but it does work in the /etc/polipo/forbidden file. Besides, adding complete domains to the uncachable file doesn t works neither. Could someone confirm this or throw me a hand on this? I m using 1.0.4.1-1.1 version which is the last one on unstable repos.

26 October 2011

Jose Luis Rivas Contreras: and issues on vim with $TERM= screen

Because of tmux I run with $TERM= screen instead of my regular rxvt-unicode, but I had a big issue with VIM because of this, it kept writing and F\n and H\n each time I pressed <end> and <home> keys respectively. I finally found the way to solve this, making VIM use $TERM= xterm internally writing this on my ~/.vimrc:
if &term == "screen"
set term=xterm
endif
So, this way, even in my servers without XTerm installed (but ncurses-term) I can use VIM as I m used to.

2 October 2011

Jose Luis Rivas Contreras: Moving from Screen to Tmux

I ve been a long-time user of GNU Screen, as almost every person I know that spend a lot of time in a terminal. I must admit I was happy, I really was. I was used to my workflow with 4 terminals 8 25 and a bunch of screens, with several nested-screens. I used awesome-wm before, so definitely I felt I wasn t using all the space in my laptop screen (my laptop is a ThinkPad X61, so 1024 768 in a 12 inches-screen) but that was OK, after all my workflow was, well, good. Until 2 days ago, I was told to try tmux, in fact, I was told and why are you using screen? use tmux . As a daily-user of Screen my first reaction was I m used to , I can use it as I want , and a lot of excuses for just not trying something new. But then I made a little research (on Google, of course). In about 30 minutes I ended up with a multiplexer working as I wanted and as I never got Screen to work. Finally I was using just a terminal and using all the space available in my tiny-laptop-screen and plus: saving a lot of bandwidth with my permanent SSH connection (a really big plus now that I m living with a capped link to the net with a GSM-modem). I changed the Ctrl-b shortcut to Ctrl-a (b is too far for using it with only one hand), configured so I could use nested tmux es like screen when I push Ctrl-a a, activated visual monitoring and even got to use the tmux s buffer along with my X11 buffer when I press Ctrl-a >!! It s all in my ~/.tmux.conf, use it at will. Later I will make a screencast about using tmux, so more people can get a working tmux easily. ATM, I m even more happy than I was with GNU Screen, so, any other recommendation, people?

13 September 2011

Jose Luis Rivas Contreras: Changing background sync d with jQueryUI Tabs

I love to use jQuery UI plugins. The one I use constantly is Tabs and this time I needed to sync the auto-changing of tab with the background. For this I used an event called tabsshow to trigger my function + the code I wrote yesterday for full-page background with CSS:
/* @author Jose Luis Rivas <joseluis@eserre.com>
*
* @desc swaping full-background pages with jQuery UI's Tabs plugin events.
*/



$(document).ready(function()

$( "#slides" ).bind( "tabsshow", function(event, ui)
var tabattr = $('.ui-state-active').find('a').attr('href');

switch(tabattr)
case '#tab1':
$('img#bg').attr('src', '/img/tab1.jpg');
break;

case '#tab2':
$('img#bg').attr('src', '/img/tab2.jpg');
break;

default:
$('img#bg').attr('src', '/img/tab1.jpg');
break;


);

);
What it does the script? Finds the active-tab identified with the .ui-state-active class and then changes the img tab src attribute according to the href attribute of the active-tab.

12 September 2011

Jose Luis Rivas Contreras: Full-Page Background with CSS with crossbrowser support

I ve been trying to get the perfect full-page background without using JavaScript since a while. I tried with CSS3 but, obviously for IE <9 was a pain in the ass, even for older Firefox' releases. So I decided to go with the plain-CSS option:
<!doctype html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<img id="bg" src="/img/bg.jpg">

<p>Content</p>
</body>
</html>
img#bg
min-width: 100%;
min-height: 100%;

/* Proportionate re-dimension */
width: 100%;
height: auto;

position: fixed; top: 0; left: 0;

z-index: -1;
What does it does? It takes an inline image and uses it as if were a background-image thanks to the z-index: -1 CSS-rule. There are lots of other techniques at CSS-Tricks but none works in every browser as this one in particular. Enjoy.

8 September 2011

Jose Luis Rivas Contreras: Moved from approx to apt-cacher-ng

I have been a long-time user of
approx
, I got used to it and knew how to configure it so all my machines + VMs used the same cache and saved me a lot of bandwidth. But that was when I got a stable connection at >100KiB/s in a daily-basis. Now I m with a mobile connection at <30KiB/s and sometimes is intermittent, so
approx
started giving me a lot of headaches. When
approx
tries to connect a host that can t be resolved its domain name, then gets 404. How does that reflects in the
/pool
? Well, you get a file
touch
d and 0 bytes size. When you try again,
approx
will find the same file with 0 bytes size and will gives you again a 404, even if you can now resolve the name address of that domain. And as I like to use what I know, then I made a workaround: Each time this happened I ran:
# find /var/cache/approx -size 0 xargs rm
So next time I requested a file to
approx
it tried to connect to the host. But I got tired. I installed
apt-cacher-ng
, tweaked a bit
/etc/apt-cacher-ng/acng.conf
so it uses port 9999 and the cache dir redirects to the same cache than
approx
and done.
apt-cacher-ng
returns 503 when it can t connect to the peer, even tries to several repositories with only a line in
/etc/apt/sources.list
in my clients. It makes me happy and keeps saving me a lot more of bandwidth than
approx
.

2 February 2011

Jose Luis Rivas Contreras: No more TweetDeck for me, on AIR

I changed (once again) to awesome and AIR applications doesn t work here. One of the apps I heavily use based on AIR is TweetDeck. So I tried old clients that were once an alternative like HootSuite but not having support for both kind of RTs (Native and Quote) is a pain in the ass. Then I remembered I installed once TweetDeck for Google Chrome on my browser and never give it a chance, because it was not exactly the same as the AIR-based app. Now it only lacks proper relation between followers and no-followers in each account when there are multiple accounts configured. So yesterday was the day to try it, the right day. It even has notification support, and customized by column!

Next.