Skip to content

Instantly share code, notes, and snippets.

View zoek1's full-sized avatar
🏠
Working from home

Miguel Angel Gordián zoek1

🏠
Working from home
View GitHub Profile
@zoek1
zoek1 / LeerConsola.java
Created May 23, 2012 15:39
Leer cadena desde cosola
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
class LeerConsola{
public static String leerCadena(){
BufferedReader Entrada = new BufferedReader(new InputStreamReader(System.in));
String Cadena = null;
try{
@zoek1
zoek1 / gist:2862188
Created June 3, 2012 06:09
Matar la primera instancia de un proceso
#!/bin/bash
function NoProceso {
echo "No existe Proceso "$1
}
function KillProceso {
kill -9 $1;
status=$?
echo $status
@zoek1
zoek1 / gist:2894425
Created June 8, 2012 08:13
Servidor de nodejs con coffescript
Servidor = require 'http'
Servidor.createServer (peticion,respuesta) ->
respuesta.writeHead(200 , "Constent-type" : "text/html")
respuesta.end("<h1> hola mundo </h1>")
.listen(3000)
@zoek1
zoek1 / Convertidor.bash
Created June 14, 2012 06:14
Convetidor de imagenes a travez de listas de archivos.
#!/bin/bash
# -*- mode: shell-script; tab-width: 4 -*-
#
# Ejecutar programa:
# Nombre_del_script Formato Lista_de_archivos
#
# Ejemplo:
# Convertidor.sh png $(pwd)/*.jpg
# Convertidor.sh jpg "Mi imagen con espacios.png" "Imagen con caracteres \*.png"
#
@zoek1
zoek1 / googlesearch.py
Created June 27, 2012 12:51
@CodeJobs GoogleSearch #Python3
#!/usr/bin/python3
import json
import urllib.parse
import urllib.request
def showsome (searchfor):
query = urllib.parse.urlencode ({'q': searchfor})
print (query)
url = 'http://ajax.googleapis.com/ajax/services/search/web?v=1.0&' + query
@zoek1
zoek1 / SeleccionaTodo.el
Created July 10, 2012 07:36
Selecciona todo el contenido del buffer actual en #emacs.
(defun Seleccionar-todo-Buffer ()
"Selecciona todo el contenido
del buffer actual"
(interactive)
(push-mark (point))
(push-mark (point-max))
(goto-char (point-min)))
(global-set-key (kbd "C-SPC") 'Seleccionar-todo-buffer)
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
@zoek1
zoek1 / goto-line-with-feedback.el
Created August 8, 2012 10:06 — forked from magnars/goto-line-with-feedback.el
Emacs: Show line numbers temporarily, while prompting for the line number input
;; turn line numbers off by default
(global-linum-mode -1)
(defun goto-line-with-feedback (&optional line)
"Show line numbers temporarily, while prompting for the line number input"
(interactive "P")
(if line
(goto-line line)
(unwind-protect
(progn
@zoek1
zoek1 / gist:3400793
Created August 20, 2012 04:18
Una ejemplo simple de la simulación de una closure en c.
#include <stdio.h>
int (* closure_clang(void)) (int, int){
int suma(int entero, int entero2){
return entero + entero2;
}
return suma;
}
@zoek1
zoek1 / gist:3475337
Created August 26, 2012 06:56
Animal_Fortune
#!/bin/bash
# Te muestra un personaje aleatorio, con una frase
# aleatoria.
#
# Puedes incluirlo en tu archivo de configuracion
# de shell, para que cad vez que inicies sesion,
# inicies de una manera diferente.
#
# Dependencias: