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 / time.sql
Created March 8, 2013 14:34
¿Cómo medir el tiempo de ejecución de una consulta o SP en Sybase?
declare @starttime datetime, @endtime datetime, @runtime int
set @starttime = getdate()
/*la consulta va aquí... select, update, insert, SP, etc.*/
set @endtime = getdate()
set @runtime = datediff(ms,@starttime,@endtime)
import sys
import subprocess
import tempfile
import urllib
text = sys.stdin.read()
chart_url_template = ('http://chart.apis.google.com/chart?'
'cht=qr&chs=300x300&chl={data}&chld=H|0')
chart_url = chart_url_template.format(data=urllib.quote(text))
@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'
@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 / 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 / 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 / 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 / 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 / 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 / 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):