Skip to content

Instantly share code, notes, and snippets.

View InFog's full-sized avatar
🤔
Thinking

Evaldo Bento InFog

🤔
Thinking
View GitHub Profile
@InFog
InFog / convertme.sh
Last active September 29, 2017 14:24
#!/bin/bash
FILE="$1"
TMP_FILE="$FILE.tmp"
if [ -f "$FILE" ]; then
IS_ISO=$(file -I "$FILE" | grep 8859)
if [ -n "$IS_ISO" ]; then
iconv -f iso-8859-1 -t utf-8 "$FILE" > "$TMP_FILE"
@InFog
InFog / infog.zsh-theme
Created May 16, 2017 17:30
Light Colorscheme for ZSH
PROMPT=$'
%{$fg[white]%}%n@%m%{$reset_color%} %{$fg[blue]%}[%/]%{$reset_color%} $(git_prompt_info)$(bzr_prompt_info)
%{$fg_bold[black]%}\$%{$reset_color%} '
PROMPT2="%{$fg_blod[black]%}%_> %{$reset_color%}"
GIT_CB="git::"
ZSH_THEME_SCM_PROMPT_PREFIX="%{$fg[green]%}["
ZSH_THEME_GIT_PROMPT_PREFIX=$ZSH_THEME_SCM_PROMPT_PREFIX$GIT_CB
ZSH_THEME_GIT_PROMPT_SUFFIX="]%{$reset_color%} "
@InFog
InFog / alertme
Created October 25, 2016 08:18
Simple alert to use with cli on Macs
#!/bin/bash
title="$1"
message="$2"
param='display notification "'$2'" with title "'$1'"'
osascript -e "$param"
# Usage: alertme "Title" "Message"
@InFog
InFog / intrun
Created February 22, 2016 10:13
Python script to run a command every 2 seconds. I use it for unit tests
#!/usr/bin/env python2
#
# This script will run something every 2 seconds and print a line in between
#
# Usage: intrun command
from subprocess import call
from sys import argv, exit
from time import sleep
@InFog
InFog / Debian R Packages
Created January 16, 2014 00:54
Debian packages for O'Reilly's "Machine Learning for Hackers"
Available packages (APT):
r-base
r-cran-ggplot2
r-cran-lme4
r-cran-reshape
r-cran-xml
CRAN only:
@InFog
InFog / ntp.sh
Created November 8, 2013 14:31
Setting DateTime using NTP
ntpdate 0.br.pool.ntp.org
@InFog
InFog / infog-bubblegum.zsh-theme
Last active December 20, 2015 19:38
Mais um tema ZSH - Baseado no Buublegum
# prompt style and colors based on Steve Losh's Prose theme:
# http://github.com/sjl/oh-my-zsh/blob/master/themes/prose.zsh-theme
#
# vcs_info modifications from Bart Trojanowski's zsh prompt:
# http://www.jukie.net/bart/blog/pimping-out-zsh-prompt
#
# git untracked files modification from Brian Carper:
# http://briancarper.net/blog/570/git-info-in-your-zsh-prompt
PR_GIT_UPDATE=1
@InFog
InFog / procedural.php
Created July 20, 2013 22:35
Exemplo para o blog, PHP Procedural
<?php
$idade = trim($_POST['idade']);
$erro = false;
if (empty($idade)) {
$erro = 'Idade não pode ser vazia';
} elseif (! is_numeric($idade)) {
$erro = 'Idade deve ser numérica';
} elseif ($idade < 18) {

Awesome PHP

A list of amazingly awesome PHP libraries, resources and shiny things.

Composer

@InFog
InFog / oo.js
Created April 25, 2013 11:12
Exemplo de OO em JS usando uma função. Existe uma associação de evento para definir o nome de p1.
var MyClass = function () {
this.name = "";
this.setName = function (name) {
this.name = name; // Este this é o MyClass, não a function atual
};
this.getName = function () {
return this.name;
};
this.keyPressSetter = function (k) {
this.name = this.name + String.fromCharCode(k.keyCode);