Skip to content

Instantly share code, notes, and snippets.

View alherd-by's full-sized avatar

Pavel Patapau alherd-by

View GitHub Profile
<?php
require_once 'HastTable.php';
const LENGTH = 150;
$length = LENGTH;
$division = function ($key) {
return $key % LENGTH;
<?php
class HastTable implements ArrayAccess
{
private $storage = [];
private $hashFunc;
public function __construct(callable $hashFunction)
{
$this->hashFunc = $hashFunction;
<?php
require_once 'HastTable.php';
const LENGTH = 20;
$hs1 = generate();
var_dump($hs1);
$hs1->bucketSort();
var_dump($hs1);
echo str_repeat('=', 150) . PHP_EOL;
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define NUM_THREADS 10
void *PrintHello(void *threadid) {
long tid;
tid = (long) threadid;
#include <semaphore.h>
#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <sys/mman.h>
#include <curses.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
#include <signal.h>
#include <string.h>
source s_nginx { udp(); };
#source s_nginx { file("/var/log/nginx/my-current/access.log"); };
filter f_local7 { facility(local7); };
destination d_loghost {tcp("10.74.0.139" port(1500));};
#destination d_loghost {file("/tmp/access.log");};
log { source(s_nginx); filter(f_local7); destination(d_loghost); };
<?php
require_once __DIR__ . '/../vendor/autoload.php';
require_once __DIR__ . '/../app/autoload.php';
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('test', true);
$kernel->boot();
try {
$container = $kernel->getContainer();
function &doSmth($arg1, $arg2){
}
$response = new StreamedResponse(function () {
while (true) {
echo 'event: message' . PHP_EOL;
echo 'data: ' . \json_encode(['data' => 1]) . PHP_EOL;
echo PHP_EOL . PHP_EOL;
ob_flush();
flush();
sleep(2);
};
});