Skip to content

Instantly share code, notes, and snippets.

View gezimbasha's full-sized avatar

Gëzim Basha gezimbasha

  • University of Prishtina
  • Prishtina, Kosova
View GitHub Profile
<!doctype html>
<!--[if (IE 8)&!(IEMobile)]><html class="no-js lt-ie9" lang="en"><![endif]-->
<!--[if (gte IE 9)| IEMobile |!(IE)]><!--><html class="no-js" lang="en"><!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<title>Ghost Admin</title>
<base href="/" />
@gezimbasha
gezimbasha / dcmotor.py
Created April 13, 2014 23:22
DC Motor for Raspberry Pi
import RPi.GPIO as GPIO
import datetime as dt
class motor():
x = 0
v = 0.87654321
def __init__(self):
GPIO.setmode(GPIO.BOARD)
GPIO.setup(7, GPIO.OUT, initial=GPIO.HIGH)
GPIO.setup(11, GPIO.OUT, initial=GPIO.HIGH)
#include<iostream>
#include <chrono>
#include <math.h>
using namespace std;
bool isPrime(int n){
for (int i = 1; ++i <= floor(sqrt(n));){
if (n % i == 0) return false;
}
return true;
@gezimbasha
gezimbasha / single-id.php
Created October 3, 2013 15:38
Adds the single-id.php to WordPress Template Hierarchy.
function get_single_template() {
$object = get_queried_object();
$id = get_queried_object_id();
$templates = array();
if ( $object )
$templates[] = "single-{$object->post_type}.php";
if ( $id )
$templates[] = "single-$id.php";
@gezimbasha
gezimbasha / Integrate.cpp
Created July 7, 2013 01:10
Simpson's method using both implementations.
#include <iostream>
#include <functional>
#include <math.h>
using namespace std;
double integrate(function<double(const double x)> f, double a, double b, int n)
{
double h = (b-a)/n;
double s = f(a)+f(b);
for(int i=1; i<n; i+=2)
#------------------------------------------------------------------------------------------------------------
def collatz(x):
max_x = 0
n = 0
while True:
if max_x < x:
max_x = x;
if x == 1:
break
@gezimbasha
gezimbasha / collatzw.py
Created May 25, 2013 22:59
Computes and plots the steps of a Collatz Sequence.
def collatzw(x):
n = 0
coll = open('collatz/plots/cplot_'+str(x)+'.dat','w')
coll.write(' 0 0 \n')
while True:
if x == 1:
break
else:
n += 1