Skip to content

Instantly share code, notes, and snippets.

View peczenyj's full-sized avatar
💻
coding

Tiago Peczenyj peczenyj

💻
coding
View GitHub Profile
@peczenyj
peczenyj / gist:8974302
Created February 13, 2014 12:32
example with ruby
2.1.0 :001 > require 'moosex'
=> true
2.1.0 :015 > class B
2.1.0 :016?> include MooseX.init(meta: true)
2.1.0 :017?> has :a
2.1.0 :018?> has [ :b, :c ]
2.1.0 :019?> has d: { doc: "d" }
2.1.0 :020?> has :e, is: :rw, doc: "eeee"
2.1.0 :021?> end
=> nil

Keybase proof

I hereby claim:

  • I am peczenyj on github.
  • I am pacman (https://keybase.io/pacman) on keybase.
  • I have a public key whose fingerprint is D9D2 107C 74EB 9F34 71A4 B23E 4783 515E 0FBE EDE5

To claim this, I am signing this object:

@peczenyj
peczenyj / monads.pl
Last active August 29, 2015 13:57
Monads in Perl, with operator >>= , is it possible?
package Maybe;
use Moo::Role;
has value => (is => 'ro', required => 1);
use overload
'>>='=> \&bind;
sub bind {
@peczenyj
peczenyj / README
Last active August 29, 2015 13:57
This script creates one fuse filesystem with one file, cat.jpg, with a random kitten image (from thecatapi.com)
NEW! you can install via cpan: https://metacpan.org/release/PACMAN/Acme-CatFS-0.001
1. you should install LWP::Simple and Fuse:Simple - use cpan or cpanm
2. you should configure the local fuse install to run as root or as common user
3. don't forget 'fusermount -u <mountpoint>' after finish the script
to install dependencies
you can use regular cpan OR cpanminus ( http://search.cpan.org/~miyagawa/App-cpanminus-1.7001/lib/App/cpanminus.pm )
use strict;
use warnings;
use feature 'say';
use Memory::Stats;
sub multiplicador{
my @ini = (100..999);
my $fim = 999;
my @memo;
while ($fim != 100){
@peczenyj
peczenyj / coligacoes.sh
Last active August 29, 2015 14:05
Script que mostra quantas vezes um partido coliga com outro por estado
#!/bin/bash
#
# Este script vai consultar o json da globo.com e vai mostrar em
# quantos estados o partido X coliga com os outros partidos
#
PARTIDO=${1:?favor informar o partido}
URL=http://estaticog1.globo.com/2014/07/Coligacoes/eleicao.json
echo "Coligações do partido $PARTIDO"
@peczenyj
peczenyj / input.txt
Last active August 29, 2015 14:09
remover bloco para fim de arquivo.
lala
begin
sddasdas
asdasdasd
asdasd
end
lolo
@peczenyj
peczenyj / A.java
Created November 18, 2014 10:10
toString example
import java.util.*;
public class A {
String name;
public A(String name) { this.name = name; }
public String toString(){ return "A[" + this.name + "]"; }
public static void main ( String [] args ) {
@peczenyj
peczenyj / HTML.pm
Created January 19, 2015 21:10
generate dynamic html with perl
package HTML;
use strict;
use warnings;
use feature 'say';
sub import {
my $self = shift;
my ($callpack, $callfile, $callline) = caller;
foreach my $tag (@_) {
@peczenyj
peczenyj / hosts
Created January 28, 2015 13:12
como resolver o maldito paywall da folha
# adicione essa linha no seu /etc/hosts
127.0.0.1 paywall.folha.uol.com.br