Skip to content

Instantly share code, notes, and snippets.

View Cvar1984's full-sized avatar
⚠️
This account is under NSA investigation

Bellatrix Lugosi Cvar1984

⚠️
This account is under NSA investigation
View GitHub Profile
@Cvar1984
Cvar1984 / irc.php
Last active June 21, 2020 14:39
Simple Internet Relay Chat PHP
<?php
function read_socket($socket)
{
while($rawData = fgets($socket)) {
$data .= $rawData;
}
return $data;
}
@Cvar1984
Cvar1984 / async-parallel.cpp
Last active February 19, 2023 11:29
std::async
/**
* async multi threading with c++
* flag : -pthread -std=c++0x
*/
#include <iostream> // std::cout
#include <unistd.h> // sleep();
#include <future> // std::async
class MyClass {
/**
* sync multi threading with c++
* flag : -pthread -std=c++0x
*/
#include <thread>
#include <iostream>
#include <stdlib.h>
#include <unistd.h>
class MyClass {
@Cvar1984
Cvar1984 / daemon.cpp
Created May 2, 2020 19:11 — forked from alexdlaird/daemon.cpp
Useful as a starting point for a C++ based Linux daemon application.
#include <dirent.h>
#include <iterator>
#include <cstdlib>
#include <cstring>
#include <sstream>
#include <iostream>
#include <stdlib.h>
#include <string>
#include <sys/stat.h>
#include <syslog.h>
@Cvar1984
Cvar1984 / encode.php
Created April 28, 2020 12:11
Php quick encode file
<?php
/**
* Copyright (c) 2020 Ramdhan Firmansyah
* File : encode.php
* @author : Cvar1984 <[email protected]>
* Date : 28.04.2020
* Last Modified Date: 28.04.2020
* Last Modified By : Cvar1984 <[email protected]>
*/
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Cvar1984</title>
<meta name="author" content="Cvar1984" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"
/>
<?php
class MyClass
{
public int $property;
}
$obj = new MyClass();
$obj->property = 1;
$normal = $obj->property;
<?php
for ($i = 1; $i <= 5; ++$i) { // copy 5 process and daemonize
$pid = pcntl_fork();
if (!$pid) {
for($x=1; $x <=2; $x++) { // loop 2x
echo 'Task ' . $x . PHP_EOL;
sleep(1);
}
//echo 'In child proccess ' . $i . PHP_EOL;
#!/usr/bin/env php
<?php
/*
* Copyright (c) 2019 <cvar1984>
*
* Licensed unter the Apache License, Version 2.0 or the MIT license, at your
* option.
*
* ********************************************************************************
# for termux
# This is the main Apache HTTP server configuration file. It contains the
# configuration directives that give the server its instructions.
# See <URL:http://httpd.apache.org/docs/2.4/> for detailed information.
# In particular, see
# <URL:http://httpd.apache.org/docs/2.4/mod/directives.html>
# for a discussion of each configuration directive.
#
# Do NOT simply read the instructions in here without understanding
# what they do. They're here only as hints or reminders. If you are unsure