Skip to content

Instantly share code, notes, and snippets.

View lopesivan's full-sized avatar
🚧
Working from home

Mr. Ivan lopesivan

🚧
Working from home
View GitHub Profile
#!/bin/bash
ssh-keygen
# Quando for perguntado a você o local onde salvar o arquivo,
# escolha o lugar padrão.
# Pressione enter quando solicitado (não entre com passphrases).
# Se quiser usar uma senha, melhor. Mas daí não fica mais um SSH sem senha :D
# Este programa cria 2 arquivos:
# .ssh/id_rsa
BOX = ~/precise32.box
VM = precise32
cookbooks = lopesivan/chef
OUT = backup
all: status
new:
@vagrant box add $(VM) $(BOX)
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "precise32"
#!/usr/bin/env bash
echo "Install Apache and setting it UP"
apt-get update
apt-get install -y apache2
sudo sh -c 'echo "ServerName localhost" >> /etc/apache2/conf.d/name' && sudo service apache2 restart
rm -rf /var/www
ln -fs /vagrant /var/www
exit 0
@lopesivan
lopesivan / solução
Created March 18, 2014 05:49
Problema com upload do github
Don't use HTTP use SSH instead
change
https://github.com/WEMP/project-slideshow.git
to
git@github.com:WEMP/project-slideshow.git
you can do it in .git/config file
@lopesivan
lopesivan / priority.sh
Last active August 29, 2015 13:57
With the following command you can obtain a list of installed packages, classified by priority:
dpkg-query -Wf '${Package;-40}${Priority}\n' | sort -b -k2,2 -k1,1
So, to remove all unneeded packages (optional and extra), you can execute the following command:
sudo apt-get --simulate purge $(dpkg-query -Wf '${Package;-40}${Priority}\n' |
awk '$2 ~ /optional|extra/ { print $1 }')
I added the --simulate option to be safe and see what apt says.
Strangely, it asks to remove also some required packages: e2fsprogs, util-linux, hostname and upstart, so it is necessary to reinstall these packages. I would download the packages in advance (apt-get download <packages>), to avoid network problems after.
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "cf"
config.vm.synced_folder ".", "/Workspace", id: "vagrant-root"
# config.vm.network :private_network, ip: "10.10.10.1"
forward_port = ->(guest, host = guest) do
config.vm.network :forwarded_port,
guest: guest,
npm ls -g -p | grep -v node_modules.*node_modules | awk -F/node_modules/ '{print $2}' | grep -vE '^(npm|)$' | xargs npm -g rm
deploy_user = node[:deploy][:user]
deploy_user_home = File.join('/', 'home', deploy_user)
rvm_version = "head"
execute "install_rvm_for_deploy_user" do
user deploy_user
command "curl -L https://get.rvm.io | bash -s #{rvm_version}"
environment "HOME" => deploy_user_home
creates "#{deploy_user_home}/.rvm"
end
require 'openssl'
require 'base64'
require 'securerandom'
def hash_hostname(hostname, salt_b64=nil)
if salt_b64
salt = Base64.decode64(salt_b64)
else
salt = SecureRandom.random_bytes(20)
salt_b64 = Base64.encode64(salt).strip