Skip to content

Instantly share code, notes, and snippets.

View vertexclique's full-sized avatar
🎛️
https://sptfy.com/QnOi

Theo M. Bulut vertexclique

🎛️
https://sptfy.com/QnOi
View GitHub Profile
int gcd( int a, int b)
{
int temp;
while(b>0)
{
if(a>b)
{temp=a;
a=b;
b=temp;}
@vertexclique
vertexclique / threepoints.m
Created June 4, 2011 09:49
3 nokta alan ve bu noktaların oluşturduğu üçgenin alanı ve açılarını hesaplayan fonksiyon
function threepoints(a,b,c)
if( length(a) ~= 3 || length(b) ~= 3 || length(c) ~= 3 )
error('invalid points. points are like (x,y,z)');
end;
v1 = b - a;
v2 = c - a;
@vertexclique
vertexclique / interpolation.m
Created June 4, 2011 09:52
Derive an equation from point like (x,y), its arguments are x=[x0,x1,...,yn] and y=[y0,y1,...,yn]
function interpolation(x,y)
boyut = length(x);
for i=1:boyut
for j=1:boyut
if( j==1) mat(i,j) = 1;
continue;
@vertexclique
vertexclique / distance.m
Created June 4, 2011 09:53
finding the distance between two vectors
function y = distance(a,b)
if length(a) == length(b)
size = length(a);
if size < 2
error('The vectors size must greater than one');
end;
else
function y = dot(a,b)
if length(a) == length(b)
size = length(a);
if size < 2
error('The vectors size must greater than one');
end;
else
@vertexclique
vertexclique / resolution.rb
Created July 3, 2011 18:52
Website çözünürlüğü
require 'net/http'
Net::HTTP.get_print_rsl('SİTENİNFULLADRESİ', 'SİTENİN DİZİNİ')
require 'net/http'
puts "Enter the site adress you want to suck:
Note that, directory must be specified
For example: http://regularlambda.github.com/blabla
or simply http://regularlambda.github.com/"
a = gets
url = URI.parse(a.chomp!)
response = Net::HTTP.start(url.host, url.port) do |http|
@vertexclique
vertexclique / scala-install.sh
Created September 13, 2011 19:50
scala home directory symlink script
cd ~/scala
sudo ln -s scala scala
cd /usr/local/bin
sudo ln -s ~/scala/bin/scala scala
sudo ln -s ~/scala/bin/fsc fsc
sudo ln -s ~/scala/bin/scalac scalac
sudo ln -s ~/scala/bin/scaladoc scaladoc
cd ~
scala
#Newbie programmer
def factorial(x):
if x == 0:
return 1
else:
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
# Newbie programmer
$input=<>;
sub factorial {
$s=1;
$r=1;
while ($s <= $input) {
$r *= $s;
$s++;
}
if($input == 0)