Skip to content

Instantly share code, notes, and snippets.

View vdonchev's full-sized avatar

mr.d vdonchev

View GitHub Profile
#include<iostream>
using namespace std;
int main ()
{
int wk, wq, wr, wb, wkn, wp;
int bk, bq, br, bb, bkn, bp;
cin >> wk >> wq >> wr >> wb >> wkn >> wp;
#include<iostream>
using namespace std;
int main ()
{
int w1, h1, w2, h2;
cin >> w1 >> h1 >> w2 >> h2;
if (w2 < w1) {
cout << ((h1 + h2) * 2) + (w2 + (w1 - w2) + w1) + 4;
} else {
<?php
$source = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
for ($i = 0; $i < count($source); $i++) {
for ($j = 0; $j < count($source); $j++) {
if ($j == $i) {
continue;
}
$numA = intval($source[$i] . $source[$j]);
<?php
$now = new DateTime();
$run_01_start = (new DateTime())->setTime(0, 0);
$run_01_end = (new DateTime())->setTime(1, 0);
$run_02_start = (new DateTime())->setTime(12, 0);
$run_02_end = (new DateTime())->setTime(13, 0);
$run_03_start = (new DateTime())->setTime(18, 0);
$run_03_end = (new DateTime())->setTime(19, 0);

Mounting VirtualBox shared folders on Ubuntu Server 18.04 LTS (Bionic Beaver)

This guide will walk you through the steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest.

Prerequisites

This guide assumes that you are using the following setup:

You could still make this guide work with other setups (possibly with some modifications to the commands and whatnot).

@vdonchev
vdonchev / .htaccess
Created March 22, 2021 17:19
PHP Front Controller
Options -Indexes
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-s
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^.*$ index.php [NC,L]
#!/bin/bash
cd /var/www/html
echo "<?php phpinfo();" > /var/www/html/i.php && curl -s http://localhost/i.php | sed 's/<[^>]*>//g' | grep 'PHP Version' && rm /var/www/html/i.php
@vdonchev
vdonchev / video_duration.php
Created February 15, 2021 06:41 — forked from xeoncross/video_duration.php
Get video duration from ffmpeg
<?php
$file = 'TrunkMonkey_Rescue.mov';
$result = shell_exec('ffmpeg -i ' . escapeshellcmd($file) . ' 2>&1');
preg_match('/(?<=Duration: )(\d{2}:\d{2}:\d{2})\.\d{2}/', $result, $match);
print_r($match);
@vdonchev
vdonchev / icecast-kh
Created February 5, 2021 04:44 — forked from ssamjh/icecast-kh
icecast-kh init.d Script (Ubuntu 20.04)
#!/bin/bash
### BEGIN INIT INFO
# Provides: icecast-kh
# Required-Start: $remote_fs $network
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Starts the icecast-kh audio streaming server daemon
### END INIT INFO
#
a.asc, a.desc, a.sortable {
text-decoration: none !important;
}
a.asc:after {
content: "\2193";
}
a.desc:after {
content: "\2191";