Skip to content

Instantly share code, notes, and snippets.

View hilios's full-sized avatar
🛠️
Breaking stuff

Edson Hilios hilios

🛠️
Breaking stuff
View GitHub Profile
@hilios
hilios / gis.py
Last active August 29, 2015 14:21
Geographic Information Algorithms
# -*- coding: utf-8 -*-
import math
import re
from decimal import Decimal
# SAD-69 World Datum
A = 6378160
E2 = 0.00669454185
@hilios
hilios / sample
Created May 6, 2015 12:04
Sodoku solver
$ sudoku
Row[1] : ---------
Row[2] : -----3-85
Row[3] : --1-2----
Row[4] : ---5-7---
Row[5] : --4---1--
Row[6] : -9-------
Row[7] : 5------73
Row[8] : --2-1----
Row[9] : ----4---9
@hilios
hilios / exercicio-1.py
Last active April 7, 2024 12:33
Instituto Mauá de Tecnologia - Trabalho prático I (http://bit.ly/1D8yncN)
# -*- coding: utf-8 -*-
"""1) Construa um algoritmo que, tendo como dados de entrada dois
pontos quaisquer no plano, P(x1,y1) e P(x2,y2), escreva a distância
entre eles. A fórmula que efetua tal cálculo:
d = sqrt(Δx^2 + Δy^2)
"""
import lib
import math
def distancia(p1, p2):
@hilios
hilios / README.md
Last active September 8, 2024 22:39
ngPageTitle - AngularJS page title service

$pageTitle

Allows to control the page title from the AngularJS route system, controllers or any other component through an injectable service.

ngPageTitle - Page title service (run tests)

To get started add the module to your app and configure the page title provider:

@hilios
hilios / Gruntfile.js
Created March 9, 2014 21:11
Grunt builmap task
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
buildmap: {
files: ['<%= source.root %>'],
dest: '<%= source.dest %>'
}
});
grunt.registerTask('default', ['buildmap'], function() {
@hilios
hilios / _formset_template.html
Last active October 26, 2017 15:34
AngularJS Django Formset
<div django-formset-child>
{{form.as_p}}
<button django-formset-remove>Remove</button>
</div>
@hilios
hilios / pyenv.sh
Created May 21, 2013 19:43
Execute shell command getting aware of pythonbrew configuration
# http://joshuawherring.com/blog/?p=2361
source "/path/to/.pythonbrew/etc/bashrc"
VENV=$2
PY=$1
pythonbrew use ${PY}
echo "Using ${PY}"
pythonbrew venv use ${VENV}
echo "Venv ${VENV}"
shift 2
echo "Executing $@ in ${VENV}"
@hilios
hilios / rAF.js
Created April 22, 2013 23:34 — forked from paulirish/rAF.js
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@hilios
hilios / README.md
Created November 29, 2012 14:12
Mouse compass

Mouse compass

Display the current mouse region inside a DOM element just like a compass. See in action!

@hilios
hilios / grant.sql
Created October 29, 2012 16:14
Create DB and User in MySQL
--
CREATE DATABASE dbname DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci;
-- Where % is the wildcard for any host
GRANT ALL PRIVILEGES ON dbname.* TO 'user'@'host' IDENTIFIED BY 'password' WITH GRANT OPTION;
-- Update users privileges access
FLUSH PRIVILEGES;