Skip to content

Instantly share code, notes, and snippets.

View orlybg's full-sized avatar

Orlando Briceño Gómez orlybg

View GitHub Profile
@orlybg
orlybg / primos.rb
Last active December 18, 2015 02:29
#classic
def is_prime n
for d in 2..(n - 1)
if (n % d) == 0
return "no"
end
return "yes"
end
end
@orlybg
orlybg / musica.xml
Last active December 14, 2015 02:28
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl ="http://www.w3.org/2002/07/owl#">
<owl:Ontology rdf:about="xml:base"/>
<owl:Class rdf:ID="genero">
<rdfs:comment>Generos musicales.</rdfs:comment>
</owl:Class>
<?xml version="1.0"?>
<rdf:RDF
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl="http://www.w3.org/2002/07/owl#">
<owl:Ontology rdf:about="">
<owl:versionInfo>Version 0.1</owl:versionInfo>
<rdfs:comment>
Ontologia personas
@orlybg
orlybg / SingleLinkedList.java
Created October 30, 2012 04:35
Empiric single linked list
class Node
{
private Node next;
private Object data;
public Node(Object data, Node next) {
this.next = next;
this.data = data;
}
@orlybg
orlybg / story.txt
Created August 9, 2012 19:26
Plain text moral story
A boat docked in a tiny Mexican village. An American tourist complimented the Mexican fisherman on the quality of his fish and asked how long it took him to catch them. “Not very long,” answered the Mexican.
“But then, why didn’t you stay out longer and catch more?” asked the American.
The Mexican explained that his small catch was sufficient to meet his needs and those of his family.
The American asked, “But what do you do with the rest of your time?”
“I sleep late, fish a little, play with my children, and take a siesta with my wife. In the evenings, I go into the village to see my friends, have a few drinks, play the guitar, and sing a few songs. I have a full life.”
@orlybg
orlybg / plot2.rb
Created December 5, 2011 23:24
gnuolot example 2
require 'gnuplot'
# tryout gnuplot
Gnuplot.open do |gp|
Gnuplot::Plot.new( gp ) do |plot|
plot.xrange "[-10:10]"
plot.title "Sin Wave Example"
plot.ylabel "x"
@orlybg
orlybg / reader.rb
Created November 29, 2011 22:31
Programa que toma un nombre de archivo como argumento de la linea de comando y lee el archivo especificado
# se usaria ruby reader.rb elarchivito.txt
def leeArchivo(archivito)
data = ''
f = File.open(archivito, "r")
f.each_line do |linea|
data = data + linea
end
return data
end
@orlybg
orlybg / saver.rb
Created November 29, 2011 22:22
Programa que toma dos argumentos de linea de comando, una cadena y un nombre de archivo
# el programa se debera correr asi:
# ruby saver.rb "eso es lo que se escribira en el archivo" elarchivo.txt
def salvarArchivo(cadena, archivo)
File.open(archivo, 'w') do |f2|
f2.puts cadena
end
end
##### MAIN #####
<?php
echo "calando...";