Skip to content

Instantly share code, notes, and snippets.

View wilsonsilva's full-sized avatar

Wilson Silva wilsonsilva

View GitHub Profile
var aRebobinar:Boolean = false;
botaoesquerda.addEventListener(MouseEvent.CLICK, animar);
botaodireita.addEventListener(MouseEvent.CLICK, retroceder);
mcinvi.addEventListener(MouseEvent.ROLL_OVER, parar);
mcinvi.addEventListener(MouseEvent.ROLL_OUT, tocar);
mcinvi.buttonMode = true;
function parar(event:MouseEvent)
@wilsonsilva
wilsonsilva / font-issue.html
Last active January 4, 2016 19:19
Paper.js font weight issue
<!DOCTYPE html>
<html>
<body>
<canvas id="canvas"></canvas>
<!-- Paper.js v0.9.15 Date: Sun Dec 1 23:54:52 2013 +0100 -->
<script type="text/javascript" src="https://rawgithub.com/paperjs/paper.js/master/dist/paper-full.min.js"></script>
<script type="text/javascript">
window.onload = function() {
var canvas = document.getElementById('canvas');
paper.setup(canvas);
@wilsonsilva
wilsonsilva / duplicate_pg_database.sh
Last active August 29, 2015 13:59
Duplicate Postgres Database
su - postgres
pg_dump -f /tmp/dump_name.sql -U postgres current_database_name
psql -f /tmp/dump_name.sql new_database_name
@wilsonsilva
wilsonsilva / nginx.repo
Created April 27, 2014 15:30
nginx.repo
[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/$releasever/$basearch/
gpgcheck=0
enabled=1
@wilsonsilva
wilsonsilva / remote_git_repo_instructions.txt
Created April 28, 2014 01:37
How to set up a remote git repository on a remote machine
On the remote server:
mkdir -p /home/username/repositories/my-repo.git
cd /home/wsilva/repositories/my-repo.git
git init --bare
On my machine:
git remote add git remote add origin username@hostname:/home/wsilva/repositories/my-repo.git
git push origin master
@wilsonsilva
wilsonsilva / arp_tables_mitigation.sh
Last active September 26, 2015 23:25
ARP poisoning mitigation
#!/bin/sh
# Set the router IP and MAC addresses before running the script
ROUTER_IP_ADDRESS=192.168.0.1
ROUTER_MAC_ADDRESS=10:FE:ED:4F:FD:3A
arptables -P INPUT DROP
arptables -P OUTPUT DROP
# Only accept arp requests from my router.
@wilsonsilva
wilsonsilva / arpwatch
Created May 26, 2014 21:27
Arpwatch configuration
# -u <username> : defines with what user id arpwatch should run
# -e <email> : the <email> where to send the reports
# -s <from> : the <from>-address
# -i <interface> : override the default network interface
OPTIONS="-u arpwatch -e wsilva -s 'root (Arpwatch)' -i wlp3s0"
@wilsonsilva
wilsonsilva / cls.sh
Last active August 29, 2015 14:02
Reset Command Line
# Create an alias for the command (an abbreviation)
alias cls='echo -en "\ec"'
# Usage:
cls
@wilsonsilva
wilsonsilva / install_ruby.sh
Created July 23, 2014 17:44
Install ruby and rubygems from source
# TODO: Use variables for the versions
# TODO: Accept command-line arguments and install everything
# Install Ruby
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.gz
tar xvzf ruby-2.1.2.tar.gz
cd ruby-2.1.2
./configure --prefix=/usr
@wilsonsilva
wilsonsilva / set_timezone.sh
Created July 29, 2014 10:25
Set timezone in CentOS
# Sets the timezone to Europe/Lisbon
sudo mv /etc/localtime /etc/localtime.bak
sudo ln -s /usr/share/zoneinfo/Europe/Lisbon /etc/localtime