Skip to content

Instantly share code, notes, and snippets.

View lslucas's full-sized avatar

Lucas Serafim lslucas

View GitHub Profile
@lslucas
lslucas / gist:6160155
Created August 5, 2013 22:26
How to Fix Vagrant Up Error Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory In my case this error happens when I changed my RAM. Why? No idea :S
Bringing machine 'default' up with 'virtualbox' provider...
[default] Setting the name of the VM...
[default] Clearing any previously set forwarded ports...
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.
Command: ["hostonlyif", "create"]
@lslucas
lslucas / proftpd.conf
Created July 31, 2013 21:10
/etc/proftpd/proftpd.conf with Disabled PASV mode
ubuntu@ip-10-248-47-171:~$ cat /etc/proftpd/proftpd.conf
#
# /etc/proftpd/proftpd.conf -- This is a basic ProFTPD configuration file.
# To really apply changes, reload proftpd after modifications, if
# it runs in daemon mode. It is not required in inetd/xinetd mode.
#
# Includes DSO modules
Include /etc/proftpd/modules.conf
@lslucas
lslucas / how-to
Last active October 18, 2019 08:51
Git Deploy Management
First, make sure you already have git installed on local and remote server.
On remote server
----------------
$ cd ~/ #if you are not here yet
$ mkdir website.git && cd website.git
$ git init --bare
Initialized empty Git repository in /home/ubuntu/website.git/
$ vi hooks/post-receive # paste the post-receive file here
@lslucas
lslucas / gist:5673356
Created May 29, 2013 19:58
List sum commits by contributor
git shortlog -s -n
@lslucas
lslucas / mongoimport.sh
Last active December 15, 2015 10:49
Mongo Import a single json file to a new collection
#import a single json file
$ mongoimport -h 127.0.0.1 -c subprovider -db techtravel --file subprovider.json
#import csv file
$ mongoimport -d mydb -c things --type csv --file locations.csv --headerline
#export a single collection
$ mongoexport --db techtravel --collection subprovider --out /var/www/techtravel/storage/database/2013-04-03/subprovider.json
#export a single collection but specific data from that collection
$environments = array(
'development' => array('http://localhost*', '*.dev'),
'production' => array('http://mywebsite.com*', '*.mywebsite.com'),
);
@lslucas
lslucas / gist:4551402
Created January 16, 2013 22:07
phpize and pecl problem
$ sudo pecl install mongo
downloading mongo-1.3.3.tgz ...
Starting to download mongo-1.3.3.tgz (122,098 bytes)
...........................done: 122,098 bytes
49 source files, building
running: phpize
Configuring for:
PHP Api Version: 20090626
Zend Module Api No: 20090626
Zend Extension Api No: 220090626
@lslucas
lslucas / gist:3820715
Created October 2, 2012 16:27
Vagrant ssh fails with VirtualBox
Problem:
$ vagrant up
[default] VM already created. Booting if its not already running...
[default] Running any VM customizations...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- ssh: 22 => 2222 (adapter 1)
[default] -- db2: 30003 => 30003 (adapter 1)
[default] Cleaning previously set shared folders...
@lslucas
lslucas / .profile
Created September 27, 2012 14:43
Show current branch on git repo folder. Colorized
## based on http://www.developerzen.com/2011/01/10/show-the-current-git-branch-in-your-command-prompt/
function parse_git_branch () {
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
BLUE="[\033[0;34m\]"
DARK_BLUE="[\033[1;34m\]"
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
@lslucas
lslucas / Iframe Javascript ContentFunctions
Created January 18, 2012 19:33
Execute (outside iframe) javascript function (inside iframe)
#vc dentro de Iframeid
parent.document.getElementById("IframeId");
#vc fora dos iframes tentando chamar uma funcão javascript que está dentro de um iframe
document.getElementById("IframeId").contentWindow.HelloWorld();
#pegar conteúdo do iframe
var iframe = parent.document.getElementById( "iframeReport");
var innerDoc = iframe.contentDocument || iframe.contentWindow.document;