Skip to content

Instantly share code, notes, and snippets.

package main
import (
"fmt"
"math/rand"
"sort"
"time"
"github.com/emirpasic/gods/sets/treeset"
)
@febuiles
febuiles / utf8.go
Last active February 29, 2024 07:17
package main
import (
"fmt"
"io/ioutil"
"math/rand"
"os"
"time"
"unicode/utf8"
)
{
"detector": {
"name": "GitHub Dependabot Push-Time Snapshot",
"url": "https://github.com/github",
"version": "0.1.0"
},
"version": 0,
"job": {
"correlator": "420195478:internal/nginx/modules/package-lock.json",
"id": "13111654504"

Hace un tiempo leí en Reddit una pregunta que decía algo como:

Si usted tuviera que culearse a dos niñas, cuyas edades sumadas den 20 años, qué edades escogería?

Piense por un segundo en la pregunta, es importante, y recuerde su respuesta ya que la vamos a usar en unos minutos.

Me encanta esa pregunta porque es la forma más fácil que conozco de detectar si la persona con la que estoy hablando es alguien con quien podría mantener algún tipo de relación o no. He hecho la misma pregunta a diferentes grupos con respuestas muy diferentes. En un caso en particular pasamos a

  • AGPL-3.0-only
  • Apache-2.0
  • AGPL-3.0
  • AGPL-3.0-only
  • AGPL-3.0-or-later
  • Apache-2.0
  • BSD-3-Clause
@febuiles
febuiles / songs.md
Last active July 1, 2022 03:45
Fetching lyrics in Unix

Fetching lyrics in the command line

Objective: Print the lyrics for the current playing song.

How: We'll create a small bash script to do the fetching for us (using curl) and then we'll display it either in the terminal or in our $EDITOR

Get the current song

First we'll need to get the name of the current song and its artist:

# Updated version is always at: https://gist.github.com/febuiles/1549991
#!/bin/bash
artist=`osascript -e'tell application "iTunes"' -e'get artist of current track' -e'end tell'`
title=`osascript -e'tell application "iTunes"' -e'get name of current track' -e'end tell'`
song=`curl -s --get "https://makeitpersonal.co/lyrics" --data-urlencode "artist=$artist" --data-urlencode "title=$title"`
echo -e "$artist - $title\n$song"
@febuiles
febuiles / spec.el
Created December 29, 2011 05:03
Run Rails spec files inside Emacs, looking for fast specs first.
(defun fast-spec-file(file)
(gsub (gsub file "app/" "spec/fast/") ".rb" "_spec.rb"))
(defun run-spec()
"Runs the specs for the buffer where this is called.
The spec lookup works like this:
1. For foo.rb it'll look for spec/fast/[models|controllers|...]/foo_spec.rb
2. If (1) fails it will run `rspec-verify`."
(interactive)
(let* ((file-name (buffer-file-name))
@febuiles
febuiles / hubot.sh
Created November 25, 2011 22:02
Hubot startup script
#!/bin/sh
# This assumes you have:
# 1) A user called `hubot` in charge of the bot.
# 2) A file called /home/hubot/.hubotrc that contains the Hubot credentials.
#
# To set the adapter either edit bin/hubot to specify what you want or append
# `-- -a campfire` to the $DAEMON variable below.
#
### BEGIN INIT INFO
import iTunesLibrary
import Foundation
let library = try ITLibrary(apiVersion: "1.0")
let localPlaylists = library.allPlaylists
var result: [String: [Any]] = [:]
var playlists: [Any] = []