Skip to content

Instantly share code, notes, and snippets.

View lslucas's full-sized avatar

Lucas Serafim lslucas

View GitHub Profile
@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 / 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
$environments = array(
'development' => array('http://localhost*', '*.dev'),
'production' => array('http://mywebsite.com*', '*.mywebsite.com'),
);
@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
@lslucas
lslucas / gist:5673356
Created May 29, 2013 19:58
List sum commits by contributor
git shortlog -s -n
@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 / 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 / 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 / modal.md
Created September 6, 2013 14:39
Pure CSS Modal
#modal {
    display: block;
    position: fixed;
    top: 50%;
    left: 50%;
    box-sizing: border-box;
    transform: translate(-50%, -50%);
}
@lslucas
lslucas / backup-mysql.php
Created September 16, 2013 15:22
Download a backup of entire database.
<?php
backup_tables('localhost', 'DB_USER', 'DB_PASS', 'DB_DATABASE');
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);