Skip to content

Instantly share code, notes, and snippets.

View gustavonovaes's full-sized avatar

Gustavo Novaes gustavonovaes

View GitHub Profile
// TODO: Calcular corretamente as Permutações e Comparações dos Algoritmos
// TODO: Implementar Busca Sequêncial e Binária para 2ª parte do exercício
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<time.h>
#define MAX_EXIBICAO_VETOR 10
#define MAX_RAND 4096
@gustavonovaes
gustavonovaes / after_install_win10.bat
Last active March 8, 2017 14:30
Things to do after install windows 10
@powershell -NoProfile -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
choco install -y clink sysinternals putty 7zip notepadplusplus vlc greenshot git.install gimp GoogleChrome VisualStudioCode nodejs.install
@gustavonovaes
gustavonovaes / validator.php
Created April 7, 2017 13:57
Helper para o vlucas/valitron
<?php
function validate(array $data, array $rules)
{
$v = new Valitron\Validator($data);
foreach ($rules as $rule => $fields) {
$optional = null;
@gustavonovaes
gustavonovaes / ping_monitor.sh
Last active August 24, 2017 17:54
Guarda log do horário que o ping ao host falha
#/bin/sh
host=$1
log_path=$2
if [ ! -f $log_path ]; then
touch $log_path
fi
store_fail() {
@gustavonovaes
gustavonovaes / flask_auth_basic.py
Created October 8, 2017 20:25
Flask Auth Basic
from functools import wraps
from flask import Flask, Response, request
from flask_babel import Babel
app = Flask(__name__)
babel = Babel(app)
app.config.from_object('config')
#!/usr/bin/env python
# Copyright (c) 2011-2015 Ben Croston
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
# of the Software, and to permit persons to whom the Software is furnished to do
# so, subject to the following conditions:
#!/bin/bash
#
# cron script to otimize space on file sharing server
#
# Written by Gustavo Novaes <[email protected]> for Mercantil Real
search_path=/mnt/samba
find $search_path -iname '*.csv' -or -iname '*.txt' -or -iname '*.mfd' | while IFS= read -r f; do
size=$(stat -c%s "$f")
<?php
$json = <<<'EOD'
[
{
"id": 1,
"name": "Sopa de castanha do par\u00e1",
"price": 9.82,
"specifications": [
"low-carb"
@gustavonovaes
gustavonovaes / Dockerfile
Created January 17, 2018 20:16
Diretório vendor é criado no host porém fica inacessível.
# docker build . --tag teste
# docker run -v `pwd`/vendor:/app/vendor -it teste sh
FROM php:7.1-alpine
RUN curl -sS https://getcomposer.org/installer | php && \
mv composer.phar /usr/local/bin/composer
RUN adduser -D -u 1000 smr