Skip to content

Instantly share code, notes, and snippets.

View lnaia's full-sized avatar
🏠
Working from home

Luis Naia lnaia

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am lnaia on github.
  • I am lnaia (https://keybase.io/lnaia) on keybase.
  • I have a public key whose fingerprint is 1CB7 A761 E35B C95B C66E 081E 3A99 DBCC D1AC 63FB

To claim this, I am signing this object:

@lnaia
lnaia / transpose_rows.rb
Last active June 3, 2017 23:00
Transpose hash to rows and expand to match max element count.
def transpose_rows(hash)
separator = ' '
rows = []
rows << hash.keys.join(separator) # header
all = []
max_elements = 0
hash.each do |_, arr|
all << arr
max_elements = arr.length if arr.length > max_elements
(function () {
var accumulator = 0;
$('.Billing--history tr td').map(function (i, el) {
var text = el.innerText.trim();
var r = /^-\$?[0-9]+(\.[0-9][0-9])?$/;
var number;
if (text) {
@lnaia
lnaia / playlist.json
Created September 30, 2016 16:35
AngularConnect 2016 - Playlist
[{
"artist": "St. Lucia",
"music": "Before The Dive",
"album": "St. Lucia"
}, {
"artist": "Savoir Adore",
"music": "Dreamers",
"album": "Dreamers - EP"
}, {
"artist": "Little Dragon",
@lnaia
lnaia / email-offers.sh
Last active July 28, 2016 08:49
Landing.jobs (https://landing.jobs) simple bash script to email you offers filtered according to your criteria.
#!/bin/bash
# Requires curl and jq
# sudo apt-get install curl jq
TEMP_OUTPUT="/tmp/.remote-jobs.json"
EMAIL_COMMAND="mail -s 'Landing.jobs Auto' [email protected]"
API="https://landing.jobs/api/v1"
echo -n > $TEMP_OUTPUT
@lnaia
lnaia / file-type-report.sh
Created July 8, 2016 09:50
Create a report for all types of files within a given directory. Save full path to each file, and echo stat data to the screen.
#!/bin/bash
DIR=$1
EXTENSIONS=`find $DIR -type f | perl -ne 'print $1 if m/\.([^.\/]+)$/' | sort -fu`
for ftype in $EXTENSIONS; do
echo -n "Searching for $ftype ... "
find $DIR -type f -iname "*.$ftype" -fprint $ftype.log
echo found `wc $ftype.log -l | cut -d' ' -f 1` files
done
(function () {
'use strict';
angular
.module('app.offline')
.service('offlineStorageService', offlineStorageService);
offlineStorageService.$inject = ['store', 'imagePreloadService'];
function offlineStorageService(store, imagePreloadService) {
@lnaia
lnaia / oneplusx.rb
Last active November 16, 2015 14:48
Hunting for the one plus x...
#!/usr/bin/ruby
require 'nokogiri'
require 'open-uri'
doc = Nokogiri::HTML(open("https://www.reddit.com/r/oneplus/comments/3qtbx1"))
doc.css(".usertext-body .md").drop(2)[0 .. 4].each {|comment|
text = comment.text.strip
text.gsub!(/\n/, '')
puts "> #{text}\n\n"
@lnaia
lnaia / persona.txt
Last active November 10, 2015 16:57
Usability, class presentation, prototype.
Marketplace for used college/school material (ie: books).
Kevin
Male, 25-34 years old
Dublin
Motivations & Goals
Kevin never bought books online, but he is confident in his ability to do so.
He wants cheaper books. He sees the need to buy a new book every year as a waste of resources and money.
Sometimes Kevin, or his tutors, contact alumni in order to inquire about used material, namely books.
@lnaia
lnaia / draw-plot.sh
Last active October 8, 2015 22:17
barebones task #1 IoT
#!/usr/bin/gnuplot
set terminal png
set xlabel "distance"
set ylabel "power"
set title "Power vs Distance"
set grid
set style data linespoints