Skip to content

Instantly share code, notes, and snippets.

def _h(args):
fn = args[0]
rfn = fn.split('?')[0]
rfn = rfn.split('/')[-1]
while True:
wget --continue --output-document=@(rfn) @(fn)
if _.rtn == 0:
break
aliases['h'] = _h
filetype indent on
setlocal foldmethod=indent
setlocal shiftwidth=2
setlocal softtabstop=2
setlocal expandtab
setlocal indentkeys=-0#
setlocal indentkeys=-<:>
setlocal autoindent
setlocal foldlevel=999
def binary_gap(n):
gap_len = 0
best_gap = 0
i = 0
gap_started = False
while n > 0:
if n & 1:
gap_started = True
from random import randint
from random import choice
from time import sleep
import graphitesend
def get_metrics():
metrics = []
for meter in ["{0:02d}".format(i) for i in range(1, 11)]:
for (metric, base) in [("tension", 110), ("corriente", 2), ("temperatura", 35)]:
# DOES NOT WORK
def sub_word(<< w :: size(32) >>) do
for <<b <- w>>, into: <<>> do
<< :binary.at(@s_box, b) >>
end
end
# ** (ArgumentError) argument error
# :erlang.bit_size(1)
# lib/symmetric/aes.ex:27: Symmetric.AES.sub_word/1
var Payments = function() {
var endpoint = 'https://sandbox.tpaga.co/api/tokenize/credit_card';
var createToken = function(options, handler) {
if (!handler) throw new Error("Callback required");
if (!options['primaryAccountNumber']) throw new Error("No ha especificado un número de tarjeta");
if (!options['expirationMonth']) throw new Error("No se especificó un mes de vencimiento");
if (!options['expirationYear']) throw new Error("No se especificó un año de caducidad");
if (!options['cvc']) throw new Error("No se especificó una CVC");
if (!options['cardHolderName']) throw new Error("No se especificó un nombre de titular de la tarjeta");
if (!this.publicKey) throw new Error("No publicKey specified. Please call Payments.setPublicKey(...) first");
@jerojasro
jerojasro / 0_reuse_code.js
Created July 20, 2014 10:15
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
cosa = let y = 2
a = 3
in let x = y
z = a
in x + z
cosa = x + z
where x = y
z = a
where y = 2
a = 3
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] Error - <type 'exceptions.IOError'>: [Errno 13] Permission denied: 'task_ef5c59983abb0771259cf969a8b6c5ba'
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] URL: http://hg.home.org/modulo_iglesia/summary
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] File '/srv/python-virtualenvs/rhodecode/lib/python2.6/site-packages/WebError-0.10.3-py2.6.egg/weberror/errormiddleware.py', line 162 in __call__
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] app_iter = self.application(environ, sr_checker)
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] File '/srv/python-virtualenvs/rhodecode/lib/python2.6/site-packages/RhodeCode-1.1.8-py2.6.egg/rhodecode/lib/middleware/simplegit.py', line 99 in __call__
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] return self.application(environ, start_response)
[Tue Sep 13 16:46:28 2011] [error] [client 127.0.0.1] File '/srv/python-virtualenvs/rhodecode/lib/python2.6/site-packages/RhodeCode-1.1.8-py2.6.e