Skip to content

Instantly share code, notes, and snippets.

View ramayac's full-sized avatar
🏠
Working from home.

ramayac ramayac

🏠
Working from home.
View GitHub Profile
@ramayac
ramayac / main.py
Created June 13, 2011 17:24
App Engine app to let two anonymous users talk to eachother via XMPP -- http://chatwithstrangers.appspot.com
#!/usr/bin/env python
import logging
from google.appengine.api import memcache
from google.appengine.api import xmpp
from google.appengine.ext import db
from google.appengine.ext import webapp
from google.appengine.ext.webapp import util
from google.appengine.ext.webapp import xmpp_handlers
@ramayac
ramayac / html5canvas.html
Created July 8, 2011 13:51
Ejemplo sencillo/basico de página de HTML5 con elemento canvas
<html>
<head>
<script type="application/javascript">
function draw() {
var canvas = document.getElementById("canvas");
if (canvas.getContext) {
var ctx = canvas.getContext("2d");
ctx.fillStyle = "rgb(200,0,0)";
ctx.fillRect (10, 10, 55, 50);
@ramayac
ramayac / pyDigiCaptcha.py
Created September 13, 2011 21:35
Obtiene un cachimbo de imagenes con el captcha de Digicel.
import time
from urllib import urlopen
from urllib import urlretrieve
import os
import sys
import hashlib
from threading import Thread
class worker(Thread):
@ramayac
ramayac / fix.rb
Created February 28, 2012 15:24
Un sencillo script de ruby para quitar encabezados con contenido malicioso en archivos .php
#!/usr/bin/env ruby
Dir.glob('**/*.php').each do|f|
puts f
begin
contents = File.read(f)
contents = contents.gsub(/\<\?php \/\*\*\/ eval\(.*\)\);\?\>/, "")
File.open(f, 'w') {|f| f.write(contents) }
rescue
puts "FILE ERROR"
@ramayac
ramayac / mobile.php
Created May 2, 2012 16:50
CakePHP Mobile Component
<?php
/*
* @author: Rodrigo Amaya
* @description: Detecta si el cliente es un navegador movil, según el user agent.
* Este componente esta basado en WPTap.
*
* File: /app/controllers/components/mobile.php
*
*/
class MobileComponent extends Object {
@ramayac
ramayac / renmd5.py
Created May 4, 2012 15:50
Renombra a MD5 los archivos que cumplan con un patrón de búsqueda especificado.
import glob, os, hashlib
SALT = 'mysalt'
IMAGE_PATH = r'C:/file/path/'
def renombrar(dir, patron):
for rutayArchivo in glob.iglob(os.path.join(dir, patron)):
title, ext = os.path.splitext(os.path.basename(rutayArchivo))
m = hashlib.md5()
m.update (SALT + title)
@ramayac
ramayac / tinymaze.html
Created November 10, 2012 17:24
Tiny Maze JS
<html>
<head>
<meta charset="utf-8">
<title>TinyMaze</title>
</head>
<body>
<div id="maze" style="line-height: 0.7; font-size: 15px;border-color: black; border-style: solid; border-width: 1px; overflow:hidden; width:600px; height: 500px;white-space: normal;word-break: normal; word-spacing: 0px;word-wrap: normal;"></div>
</body>
<script type="text/javascript">
//A silly character based random "maze" by @ramayac
@ramayac
ramayac / copiarsps.bat
Created January 25, 2013 16:51
A simple batch file to copy files from a txt file
@echo off
echo * copiando *
for /f %%l in (lista.txt) do (
for %%f in (%%l) do (
echo "L:\%%f"
copy "L:\%%f" .
)
)
echo * listo *
pause
@ramayac
ramayac / gist:4666965
Created January 29, 2013 19:33
Turn any "modern" browser into "notepad".
Paste this in the URL bar:
data:text/html, <html contenteditable>
Source: https://news.ycombinator.com/item?id=5135194
@ramayac
ramayac / pyoauth.py
Last active December 12, 2015 02:38
import urlparse
import oauth2 as oauth
consumer_key = 'consumer_key'
consumer_secret = 'consumer_secret'
request_token_url = 'http://www.tumblr.com/oauth/request_token'
access_token_url = 'http://www.tumblr.com/oauth/access_token'
authorize_url = 'http://www.tumblr.com/oauth/authorize'