Skip to content

Instantly share code, notes, and snippets.

@carloslima
carloslima / loop_aria2.sh
Created August 13, 2018 22:22 — forked from jonbakerfish/loop_aria2.sh
aria2 downloads a list of files, loop until all file are finished
#!/bin/bash
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
while [ $has_error -gt 0 ]
do
echo "still has $has_error errors, rerun aria2 to download ..."
aria2c -j5 -i list.txt -c --save-session out.txt
has_error=`wc -l < out.txt`
sleep 10
@carloslima
carloslima / HelloAvro.scala
Created November 23, 2017 21:15 — forked from hammer/HelloAvro.scala
Concise example of how to write an Avro record out as JSON in Scala
import java.io.{IOException, File, ByteArrayOutputStream}
import org.apache.avro.file.{DataFileReader, DataFileWriter}
import org.apache.avro.generic.{GenericDatumReader, GenericDatumWriter, GenericRecord, GenericRecordBuilder}
import org.apache.avro.io.EncoderFactory
import org.apache.avro.SchemaBuilder
import org.apache.hadoop.fs.Path
import parquet.avro.{AvroParquetReader, AvroParquetWriter}
import scala.util.control.Breaks.break
object HelloAvro {
@carloslima
carloslima / archnews
Created June 8, 2015 14:25
Brief CLI access to Arch Linux news feed
#!/usr/bin/env perl
use 5.011;
use Mojo::UserAgent;
my $ua = Mojo::UserAgent->new;
my $feed_address = "https://www.archlinux.org/feeds/news/";
my $response = $ua->get($feed_address)->res;
my @items = $response->
@carloslima
carloslima / Dockerfile
Created May 17, 2015 17:32
xmonad-log-applet build using docker
FROM ubuntu:vivid
RUN apt-get update \
&& apt-get install -y git build-essential \
autoconf libdbus-glib-1-dev xfce4-panel-dev \
&& git clone git://github.com/alexkay/xmonad-log-applet.git /code \
&& cd /code && ./autogen.sh && make && make DESTDIR=/opt/xla install \
&& cd /opt/xla && tar cJf /xmonad-log-applet.tar.xz .
CMD mkdir -p /target; cp /xmonad-log-applet.tar.xz /target
@carloslima
carloslima / PKGBUILD
Created May 17, 2015 17:16
xmonad-log-applet-xfce4-2.1.0 ArchLinux package
pkgname=xmonad-log-applet-xfce4-git
pkgver=2.1.0
pkgrel=1
pkgdesc="An applet that will display Xmonad log information (XFCE)"
arch=('i686' 'x86_64')
url="https://github.com/alexkay/xmonad-log-applet"
license=('BSD3')
depends=('xfce4-panel>=4.10.0')
makedepends=('git')
source=($pkgname::git+https://github.com/alexkay/xmonad-log-applet.git#tag=2.1.0)

Keybase proof

I hereby claim:

  • I am carloslima on github.
  • I am carloslima (https://keybase.io/carloslima) on keybase.
  • I have a public key whose fingerprint is 8AAC A7F1 F49B DE5D 5E4E 7946 959E 3D46 280B 89C0

To claim this, I am signing this object:

@carloslima
carloslima / IOAll.pm
Last active December 26, 2015 00:59
Sample code on using Mo for IO::All
package IOAll;
use IOBase;
sub import {
shift;
my $caller = caller;
no strict 'refs';
*{$caller.'::io'} = sub { "oi: @_" }
}
css = """
div.Bk {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
textarea {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
td > div {
font-family: DejaVu Sans Mono, Courier, Monospace !important;
}
This is a standard Ubuntu 11.04 box
~$ perl -v
This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi
(with 53 registered patches, see perl -V for more detail)
Copyright 1987-2009, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
@carloslima
carloslima / gist:296989
Created February 6, 2010 22:11
happy gist
\o/