Skip to content

Instantly share code, notes, and snippets.

View victorfsf's full-sized avatar
🕵️‍♂️
Exploring

Victor Ferraz victorfsf

🕵️‍♂️
Exploring
View GitHub Profile
@victorfsf
victorfsf / Makefile
Last active June 29, 2016 20:21
Docker WebGoat
build:
@docker build -t webgoat .
run:
@docker run -d -ti --name webgoat -p 80:8080 webgoat
log:
@docker logs -f webgoat
stop:
# A shortcut function that simplifies usage of xclip.
cb() {
local _scs_col="\e[0;32m"; local _wrn_col='\e[1;31m'; local _trn_col='\e[0;33m'
# Check that xclip is installed.
if ! type xclip > /dev/null 2>&1; then
echo -e "$_wrn_col""Install xclip with 'apt-get xclip'.\e[0m"
# Check user is not root (root doesn't have access to user xorg server)
elif [[ "$USER" == "root" ]]; then
echo -e "$_wrn_col""Must be regular user (not root) to copy a file to the clipboard.\e[0m"
@victorfsf
victorfsf / scanner.py
Last active March 29, 2016 17:42
Regex Scanner
class Scanner(object):
def __init__(self, rules, flags=0):
pattern = Pattern()
pattern.flags = flags
pattern.groups = len(rules) + 1
self.rules = [name for name, _ in rules]
self._scanner = sre_compile(SubPattern(pattern, [
(BRANCH, (None, [SubPattern(pattern, [
@victorfsf
victorfsf / environment.yml
Last active March 28, 2016 11:37
Conda environment file example
name: example
channels:
- javascript # required to install nodejs
dependencies:
- python=3.5.1
- numpy=1.9.*
- nodejs=0.10.*
- django
- pip:
- python-iprofile
@victorfsf
victorfsf / environment.yml
Last active March 28, 2016 11:37
Python Data Warehouse Collection
name: datascience
dependencies:
- python=2.7.11
- numpy
- llvmlite=0.9.0
- numba=0.24.0
- pip:
- ipdb==0.9.0
- ipython==4.1.2
@victorfsf
victorfsf / animate-py2.py
Last active November 6, 2017 14:10
JUST RUN IT!
import sys
import time
import random
import string
def animate(
text, timing=0.05, shift=5, reverse=False,
decrypt=False, decrypt_key=1, chars=string.printable[:74]):
@victorfsf
victorfsf / Vagrantfile
Last active October 4, 2015 23:41
Vagrantfile para a máquina virtual raincife.box
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = 2
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# The most common configuration options are documented and commented below.
@victorfsf
victorfsf / django_generic_fk_mixin.py
Last active September 18, 2015 19:17
Django's Generic Foreign Key Model Mixin
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
class GenericModelMixin(models.Model):
model_id = models.PositiveIntegerField(blank=True, null=True, editable=False)
model_type = models.ForeignKey(ContentType, blank=True, null=True, editable=False)
model_object = models.GenericForeignKey('model_type', 'model_id')
@victorfsf
victorfsf / awscli.md
Last active June 12, 2017 14:44
Downloading and uploading from/to a S3 Bucket using AWS CLI

Installing & Configuring

$ sudo pip install awscli (or: sudo apt-get install awscli)
$ aws configure

You'll need to fill the following settings: