Skip to content

Instantly share code, notes, and snippets.

View dinamic's full-sized avatar
😳
I would rewrite the world, but they won't give me the source code.

Nikola Petkanski dinamic

😳
I would rewrite the world, but they won't give me the source code.
View GitHub Profile
FROM php:8.3-bookworm
RUN apt update -q \
&& apt upgrade -y \
&& apt-get install -y build-essential git libnode-dev
RUN mkdir -p /opt/v8 \
&& ln -s /usr/include/node /opt/v8/include \
&& ln -s /usr/lib/$(uname -m)-linux-gnu /opt/v8/lib
@dinamic
dinamic / gist:335bb0ed0e73e1b6af3b3f59c9fe08d1
Last active March 4, 2021 13:40
cloudflare-ddns-update.sh
#!/bin/bash
###
# Cloudflare API DDNS update script
# Heavily inspired by https://gist.github.com/lifehome/eb3f7d798f9bc6720cdc7d2be1238d4f
#
# Requirements: jq, curl
###
auth_token="XXXXXXXXXXXXXXX" # Token generated from "My profile > API Tokens"
@dinamic
dinamic / SwooleProcessManager.php
Created February 3, 2020 11:18
Draft of process manager class using Swoole
<?php
declare(strict_types=1);
namespace Petkanski\Component\ProcessManager\Service;
use LogicException;
use Swoole\Process;
use Swoole\Table;
/**
@dinamic
dinamic / recover_lost_filename.php
Last active May 23, 2018 11:12
PHP script that would guess the type of a file using its metadata and would rename it. Often times this is caused by unsafe removal of USB media off the USB slot.
<?php
$folder = __DIR__ .'/FOUND.000';
$dir = new DirectoryIterator($folder);
$map = array(
'application/vnd.ms-excel' => 'xls',
'application/msword' => 'doc',
'application/zip' => 'zip',
@dinamic
dinamic / recover_lost_filename.php
Created May 23, 2018 11:12
PHP script that would guess the type of a file and would rename it. Often times this is caused by unsafe removal of USB media off the USB slot.
<?php
$folder = __DIR__ .'/FOUND.000';
$dir = new DirectoryIterator($folder);
$map = array(
'application/vnd.ms-excel' => 'xls',
'application/msword' => 'doc',
'application/zip' => 'zip',

Keybase proof

I hereby claim:

  • I am dinamic on github.
  • I am nikola_petkanski (https://keybase.io/nikola_petkanski) on keybase.
  • I have a public key whose fingerprint is 7F19 D197 4B10 568F 986E CD32 65C5 2A9A 9B85 66F3

To claim this, I am signing this object:

<?php
ini_set('display_errors', 'On');
error_reporting(E_ALL);
$item = array ('amount' => 1.2);
$data = array ('items' => array(&$item));
// ...
$item['amount'] = 1123.23;
<?php
class MySoapServer
{
public function createItem(array $items, $calculate)
{
return 'Output is: '. json_encode(func_get_args());
}
}
/**
* @When I scroll :elementId into view
*/
public function scrollIntoView($elementId) {
$function = <<<JS
(function(){
var elem = document.getElementById("$elementId");
elem.scrollIntoView(false);
})()
JS;
@dinamic
dinamic / docker-routing.sh
Created February 23, 2016 13:17
OSX static routing to the docker containers
#!/bin/bash
sudo route -n add 172.17.0.0/16 `docker-machine ip default`
netstat -nr |grep 172\.17