Skip to content

Instantly share code, notes, and snippets.

View aziflaj's full-sized avatar
🐍
There's a snake in my boot!

Aldo Ziflaj aziflaj

🐍
There's a snake in my boot!
View GitHub Profile
@aziflaj
aziflaj / client.php
Last active November 22, 2015 14:35
A client-server (Proof of Concept) application in PHP
<?php
error_reporting(E_ALL); // report ALL the errors <insert meme here>
set_time_limit(0); // PHP, Y U NO remove time limit?!
$host = "localhost"; // or 127.0.0.1
$port = 4445; // 44th floor of the building, door number 45
$client = socket_create(AF_INET, SOCK_STREAM, 0) or die("No sockets created. Brahma has spoken!");
socket_connect($client, $host, $port) or die("Brahma needs a sacrifice to allow the connection");
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
jscs = require('gulp-jscs'),
jshint = require('gulp-jshint');
gulp.task('js', function() {
gulp.src(['./js/**/*.js'])
.pipe(jshint())
.pipe(jscs())
@aziflaj
aziflaj / UriMatcher.kt
Created October 17, 2015 18:53
This function creates a UriMatcher instance, used in an Android ContentProvider
fun createUriMatcher(): UriMatcher {
var matcher: UriMatcher = UriMatcher(UriMatcher.NO_MATCH)
val authority = TaskContract.CONTENT_AUTHORITY
matcher.addURI(authority, TaskContract.TASK_PATH, TASK)
matcher.addURI(authority, "${TaskContract.TASK_PATH}/#", TASK_WITH_ID)
return matcher
}
require 'set'
def divide_cards(card_set)
card_array = card_set.to_a
group0 = Array.new
group1 = Array.new
group2 = Array.new
for index in 0 ... card_array.size do
if index % 3 == 0
package learn;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner stdIn = new Scanner(System.in);
System.out.print("Enter the length of leg1: ");
public class IncrementDifferences {
public static void main(String[] args) {
int a = 10, b;
b = a++;
System.out.println("a=" + a + " b=" + b);
a = 10; //reset the value of a
b = ++a;
System.out.println("a=" + a + " b=" + b);
}
public class ShorthandOperators {
public static void main(String[] args) {
int value = 10;
//show the initial value
System.out.println("value=" + value);
//add 12 to the value
value += 12;
@aziflaj
aziflaj / 1.md
Last active October 29, 2021 23:43
Java Tutorials

Java Programming 1: Get started with Java programming

Java is a general-purpose, OOP language designed with the idea of Write Once, Run Anywhere (WORA), meaning that the Java code would work virtually in every computer without the need of re-compilation like C or C++. In order to obtain this unique portability, the computer needs to have the JVM (Java Virtual Machine) installed. Nowadays, Java is the most used programming language in the world, used for almost anything, from embedded programming to large software development, web application development and supercomputers. Java has 3 main implementation named Java EE, Java SE and Java ME meaning respectively Java Enterprise Edition, Java Standard Edition and Java Micro Edition (used in the abbreviated form as J2EE, J2SE and J2ME). Java, firstly developed at Sun Microsystems which merged into Oracle Corporation, was designed with 5 main principles in mind:

  • Simple, object-oriented and familiar

Java makes programming simple using its build-in classes,

#define MAX_PKT 1024 /* packet size in bytes */
typedef enum { false, true } boolean; /* boolean type */
typedef unsigned int seq_nr; /* sequence or ACK numbers */
typedef struct {
unsigned char data[MAX_PKT];
} packet; /* packet definition */
typedef enum { data, ack, nak } frame_kind; /* frame kind definition */
#include<stdio.h>
/********** Deklarimi i funksioneve te perdorura *************/
void max_heapify(int *,int);
void min_heapify(int *,int);
void build_max_heap(int *,int);
void build_min_heap(int *,int);
void max_heapsort(int *,int);
void min_heapsort(int *,int);