Skip to content

Instantly share code, notes, and snippets.

@dextervip
dextervip / cloudflare-update.py
Last active December 30, 2022 23:10 — forked from m3nu/cloudflare-update.py
Python Cloudflare Dynamic DNS Update script
#!/usr/bin/env python
"""
Update Cloudflare zone entry to current external IP.
Works great with servers on changing IPs or AWS spot instances.
Usage:
python cloudflare_update.py subdomain
@dextervip
dextervip / json_decode_datetime.php
Created July 17, 2020 01:19
Auto decode DateTime Objects in json_decode PHP
<?php
$data = json_decode($message->getBody(), true);
function array_map_recursive($callback, $array)
{
$func = function ($item) use (&$func, &$callback) {
if(is_array($item) && isset($item['date']) && isset($item['timezone_type'])){
return call_user_func($callback, $item);
}
return is_array($item) ? array_map($func, $item) : call_user_func($callback, $item);
@dextervip
dextervip / ProfilerSubscriber.php
Last active June 3, 2020 23:04
Enable Symfony Profiler for Admins In Production
<?php
namespace App\EventSubscriber;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\HttpKernel\Event\RequestEvent;
@dextervip
dextervip / export.py
Created May 3, 2020 18:20
Export Pandas Table Image with wkhtmltoimage
import subprocess
f=open("dfAccountSummary.html", "w+")
html = """
<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@dextervip
dextervip / PostgreSqlPlatform.php
Last active April 25, 2024 10:54
Symfony Doctrine support for timescaledb
<?php
namespace App\Domain\Doctrine\DBAL\Platforms;
use Doctrine\DBAL\Platforms\PostgreSQL100Platform as PostgreSqlPlatformBase;
class PostgreSqlPlatform extends PostgreSqlPlatformBase
{
@dextervip
dextervip / docker_ephemeral_create.sh
Last active July 12, 2018 16:03 — forked from kamermans/docker_ephemeral_create.sh
AWS EC2 script to mount Instance Store 0 and 1 as Docker temp and volume storage
#!/bin/sh -e
# This script will DESTROY /dev/xvdb and /dev/xvdc and remount them
# for Docker temp and volume storage.
# It is intended for EC2 instances with 2 ephemeral SSD instance stores
# like the c3.xlarge instance type.
service docker stop || true
# Setup Instance Store 0 for Docker Temp
# (set in /etc/default/docker)
<?php
namespace Dpn\ToolsBundle\Form\Type;
use Symfony\Component\Form\AbstractType;
use Dpn\ToolsBundle\Form\DataTransformer\EntityToIdTransformer;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
use Doctrine\Common\Persistence\ObjectManager;
@dextervip
dextervip / Product.php
Created May 27, 2013 05:05
Product Provider for Faker
<?php
namespace Faker\Provider\pt_BR;
/**
* Product Provider
*
* @author Rafael
*/
class Product extends \Faker\Provider\Base {
[1] Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException: The file "" does not exist
at n/a
in C:\htdocs\smileflame\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser.php line 115
at Symfony\Component\HttpFoundation\File\MimeType\MimeTypeGuesser->guess('')
in C:\htdocs\smileflame\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\File\File.php line 87
at Symfony\Component\HttpFoundation\File\File->getMimeType()
in C:\htdocs\smileflame\vendor\symfony\symfony\src\Symfony\Component\HttpFoundation\File\File.php line 64
<?php
namespace BX\AppBundle\Controller;
/**
* @Route("/item")
*/
class DefaultController extends Controller {
/**
* @Route("/new",name="item_new")