Skip to content

Instantly share code, notes, and snippets.

View alvaro-cuesta's full-sized avatar
🦀

Álvaro Cuesta alvaro-cuesta

🦀
View GitHub Profile
byte2str = (byte) ->
(String.fromCharCode(x) for x in byte).join('')
str2byte = (str) ->
(x.charCodeAt 0 for x in str)
TAPE_SIZE = 30000
CELL_WIDTH = 16
IO_WIDTH = 8
module.exports = ->
@addCommand 'kata_rectangle_Code07_mamon',
args: '<texto>'
description: 'Imprime <texto> como un rectángulo. Dedicado al mamón de Code07.'
({nick}, text, to) =>
to ?= nick
n = text.length/4
if n % 2
@alvaro-cuesta
alvaro-cuesta / qauth.py
Created December 14, 2012 19:09
Q challenge-response authentication using HMAC-SHA1
# Update 0.2 by alvaro-cuesta@GitHub
#
# Saw in http://www.nuxified.org/quakenet_q_challenge_response_auth_for_xchat
#
# - new protocol (uses HMAC-SHA-1)
# - added /QHASH <sha-1 hashed password> to auth via hash
# - added /QGEN <password> to generate a password hash (done noce)
# - autoauth (uses your network's NickServ password as a hash, leave blank to disable)
# - autocloak
# - autojoin channels once cloaked (see CHANNELS)
@alvaro-cuesta
alvaro-cuesta / mv_fetch.coffee
Created October 19, 2012 21:08
MV Quote Fetcher
request = require 'request'
express = require 'express'
app = express()
############
## CONFIG ##
############
PORT = 3000
#USER = 'xxx'
#PASS = 'xxx'
;; I came up with this off the top of my head (I'm thinking out loud here):
:groups {:user ['operator [:deny :all]
'whatis [:deny :all]]
:voicers ['operator [:allow "voice" "devoice"]]
:whatis-ops ['whatis [:allow "learn" "forget"]]
:admin []}
:users {"Jen" {:pass "123", :groups [:admin]}
"Jack" {:pass "456", :groups [:voicers :whatis-ops]}
@alvaro-cuesta
alvaro-cuesta / gist:3006297
Created June 27, 2012 19:39
Chain of handlers
;; raek's idea
(defn cool? [w]
true) ;; all words are cool
(def handlers
[[#(and (:small-word %)
(:first-word %)) #(.toUpperCase %)]
; you can even use functions as your predicate
[cool? #(.toLowerCase %)]])
@alvaro-cuesta
alvaro-cuesta / gist:3005694
Created June 27, 2012 17:56
Style: Function naming
(ns example.image)
;; This
(defn generate-image [...]
...)
;; or this
(defn generate [...]
...)