Skip to content

Instantly share code, notes, and snippets.

@sergioccrr
sergioccrr / bot.pl
Created March 15, 2012 15:29
Verdana
#!/usr/bin/perl
use strict;
use IO::Socket;
use LWP::UserAgent;
use HTTP::Request;
### Config
my $SERVER = 'calvino.freenode.net';
my $PORT = 6667;
@sergioccrr
sergioccrr / login.sh
Created April 1, 2012 14:48
Google Wave Backup
#!/bin/bash
read -p 'Email: ' user
read -s -p 'Password: ' pass
echo
rLogin=$(curl --silent --data "Email=$user&Passwd=$pass&service=wave" --write-out '%{http_code}' https://www.google.com/accounts/ClientLogin)
cLogin=$(echo $rLogin | awk '{print $NF}')
if [ $cLogin != '200' ]; then
echo 'Error en el login :-('
@sergioccrr
sergioccrr / youtube_id.php
Last active October 3, 2015 02:07
Extract the youtube ID from a URL
<?php
function youtube_id($url) {
$parsed = parse_url($url);
if (!is_array($parsed)) {
return false;
}
if (preg_match('#(^|\.)youtu\.be$#', $parsed['host']) && !empty($parsed['path'])) {
return substr($parsed['path'], 1);
@sergioccrr
sergioccrr / t2t.php
Created February 10, 2013 04:16
Tweetbot2Twitpic
<?php
define('API_KEY', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx');
function _header($code) {
$code = (int) $code;
$codes = array(
403=>'Forbidden',
404=>'Not Found',
@sergioccrr
sergioccrr / anti-magic-quotes.php
Created April 14, 2013 03:53
Anti Magic Quotes
<?php
if (get_magic_quotes_gpc()) {
$_GET = array_map('stripslashes', $_GET);
$_POST = array_map('stripslashes', $_POST);
}
@sergioccrr
sergioccrr / greader.py
Last active December 19, 2015 03:58
Download Google Reader feeds.
# -*- coding: utf-8 -*-
import requests
import urllib, time, sys
import string
def filename_string(feed):
valid_chars = "-_() %s%s" % (string.ascii_letters, string.digits)
return ''.join(c for c in feed if c in valid_chars)
def save(feed):
* {
margin: 0;
padding: 0;
outline: none;
}
html {
min-height: 100%;
overflow-y: scroll;
}
var https = require('https'),
crypto = require('crypto'),
url = require('url'),
querystring = require('querystring');
const CONSUMER_KEY = 'xxxxxxxxxxxxxxxxxxxx';
const CONSUMER_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const ACCESS_TOKEN = 'xxxxxxxxx-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const ACCESS_TOKEN_SECRET = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
@sergioccrr
sergioccrr / gist:9840c7677b8dd5873b84
Last active August 29, 2015 14:02
human implode
<?php
function human_implode($items) {
$last = array_pop($items);
$str = implode(', ', $items);
if (!empty($items)) {
$str .= ' y ';
}
$str .= $last;
return $str;
@sergioccrr
sergioccrr / factura.html
Created August 5, 2014 12:37
De cuando era autónomo
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Test</title>
<link href="http://fnt.webink.com/wfs/webink.css/?project=C70D1354-AD5F-440B-9B83-AE04D8C2E103&fonts=1B6C2E6C-BB21-53D3-2175-C814D91AD16C:f=Aller-Bold,32A3E230-3101-A662-F6D5-D8B9D0A38A5B:f=Aller-Regular,C7662775-65E4-3DE5-DE19-D61377E1BE79:f=Aller-Light,880096C9-42EC-CFB6-C094-7540101C8F7B:f=Aller-BoldItalic,9C5DF801-C745-E177-908F-369BCECD52B7:f=Aller-Italic,521D5111-7D3C-B8EC-88B6-BBED2BE5F224:f=Aller-LightItalic" rel="stylesheet" type="text/css"/>
<style type="text/css">
* {
margin: 0;
padding: 0;