Skip to content

Instantly share code, notes, and snippets.

View rbasoalto's full-sized avatar

Rodrigo Basoalto rbasoalto

  • Santiago, Chile
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@rbasoalto
rbasoalto / Clase20140910.md
Created September 11, 2014 20:42
Clase 2014/09/10

Ejercicio 1

Escriba una función que reciba una matriz e imprima sus elementos en pantalla, separados por tabulaciones. (CON FORMA DE MATRIZ)

  • cómo imprimir una tabulación: print "\t"
  • cómo saber el tamaño de una matriz: filas, columnas = matriz.shape
  • ejemplo:
>>> a=matrix([[1,2],[3,4],[5,6]])
>>> a.shape
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env ruby
# Add a web seed to a single-file torrent. Apparently it works, although I'm
# lazy enough to NOT read the torrent spec, so it might not. Tested with common
# linux distros and such.
#
# Usage: ./patchtorrent.rb original.torrent http://the.url.with/the/file.iso new.torrent
orig = File.binread(ARGV[0])
url = "8:url-list#{ARGV[1].length}:#{ARGV[1]}"
@rbasoalto
rbasoalto / gist:9405051
Last active August 29, 2015 13:57
LCM1602 (I2C 16x2 LCD module) init with Bus Pirate
# PCF8574 connections: (bit/signal)
# 7 6 5 4 3 2 1 0
# D7 D6 D5 D4 BL EN RW RS
## command 0xHL sequence is 0xH8-0xHc-0xH8-5ms-0xL8-0xLc-0xL8-5ms
## data 0xHL sequence is 0xH9-0xHd-0xH9-200us-0xL9-0xLd-0xL9-200us
## Init sequence
W
@rbasoalto
rbasoalto / killapache.pl
Created June 8, 2012 19:48
kill apache
#!/usr/bin/perl
#Apache httpd Remote Denial of Service (memory exhaustion)
#By Kingcope
#Year 2011
#
# Will result in swapping memory to filesystem on the remote side
# plus killing of processes when running out of swap space.
# Remote System becomes unstable.
#
@rbasoalto
rbasoalto / qrcode.html
Created April 4, 2012 13:35
Create a QR code using Google Chart API
<!DOCTYPE html>
<html>
<head>
<title>QRCode!</title>
<script language="javascript" type="text/javascript">
function process() {
var apiurl = "https://chart.googleapis.com/chart";
var els = document.forms["theform"].elements;
var el;
@rbasoalto
rbasoalto / urldecode.html
Created April 4, 2012 13:35
Decode parameters in a link's query string.
<!DOCTYPE html>
<html>
<head>
<title>URLDecode</title>
<script language="javascript" type="text/javascript">
function urldecode() {
try {
try {
x = document.getElementById('resultado');
x.parentNode.removeChild(x);
@rbasoalto
rbasoalto / primes.c
Created March 26, 2012 14:39
Prime factors computation
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define NPRIMES 100000
unsigned long int primes[NPRIMES];
unsigned int nprimes;
struct node;