Skip to content

Instantly share code, notes, and snippets.

@bcastellano
bcastellano / mongo_profiling.js
Last active June 7, 2016 07:26
MongoDB activar y borrar profile (log de queries)
// activar logging de queries
db.setProfilingLevel(2,0);db.setLogLevel(1);
// listar queries ejecutadas
db.system.profile.find()
// borrar queries ejecutadas y volver a activar
db.setProfilingLevel(0);db.system.profile.drop();db.setProfilingLevel(2,0);db.setLogLevel(1);
@bcastellano
bcastellano / AppBundle.php
Last active May 1, 2016 16:58
Inject Doctrine repositories to services with compiler pass in Symfony 2
<?php
namespace AppBundle;
use AppBundle\DependencyInjection\Compiler\InjectRepositoriesCompilerPass;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\HttpKernel\Bundle\Bundle;
class AppBundle extends Bundle
{
@bcastellano
bcastellano / connect_mysql_vagrant.md
Last active June 20, 2016 22:38
Connect mysql vagrant

1.- edit mysql configuration:

sudo vim /etc/mysql/my.cnf

###change:

...
bind-address            = 0.0.0.0
...
@bcastellano
bcastellano / Open in Visual Studio Code.md
Created December 15, 2017 22:54
Mac os context menu service: Add new service to mac os context menu
  1. Open up Automator.app located in your Applications folder.
  2. Choose ”Service” in the dialog sheet when creating a new document.
  3. In the Services receives selected: menu at the top of the ”Canvas” on the right, change to ”Files & Folders”.
  4. In the sidebar to the left, search for Get Selected Finder Items
  5. Drag this Action to the ”canvas” on the right side.
  6. Again, go to the sidebar at the left and this time search for Run Shell Script
  7. Drag the Run Shell Script action to the ”canvas” on the right side.
  8. At the right in the Run Shell Script action, change the Pass input from to stdin to as arguments
  9. Copy paste this into the action text box, removing the Cat command in the text box:
@bcastellano
bcastellano / raspberry-pi-cups.md
Last active July 1, 2024 02:13
Configure Raspberry to be print server with cups and adding HP LaserJet 1020
@bcastellano
bcastellano / .vimrc
Created January 30, 2022 18:13
Vim configuration
" Turn on syntax highlighting
syntax on
" Show line numbers
set number
" Encoding
set encoding=utf-8
" Use spaces instead of tabs