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 / 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;
public class Car {
/**
* Diz que a variavel não pode ser nula
*/
@NotNull
private String manufacturer;
/**
* Diz que a variavel não pode ser nula e o tamanho tem que ser maior ou igual 2 e no maximo 14
@dextervip
dextervip / ActivitiService.php
Created November 9, 2012 04:18 — forked from lucassouza1/ActivitiService.php
Activiti Rest Client PHP
<?php
class ActivitiService{
const BASE_URL = 'http://localhost:8080/activiti-rest/service/';
const ADMIN_USERNAME = 'kermit';
private $_services = array(
'processDefinitions' => 'process-definitions',
'processDefinition' => 'process-definition/',
@dextervip
dextervip / todo.php
Created September 28, 2012 03:18 — forked from alganet/todo.php
A very small PHP todo list that saves to the database in 32 lines
<?php
//The actual implementation is just this file. Others are usage and tests.
class TodoList extends ArrayObject
{
const CREATE = 'CREATE TABLE IF NOT EXISTS tasks (name VARCHAR(32) PRIMARY KEY, status INT)';
const SELECT = 'SELECT * FROM tasks';
const INSERT = 'INSERT INTO tasks VALUES (?,?)';
const UPDATE = 'UPDATE tasks SET status = ? WHERE name = ?';
@dextervip
dextervip / BusinessDaysTest.php
Created September 28, 2012 03:16 — forked from netojoaobatista/BusinessDaysTest.php
Algorítimo idiota (e caro) para cálculo de dias úteis entre duas datas.
<?php
require_once 'PHPUnit/Framework/TestCase.php';
require_once 'businessDays.php';
/**
* businessDays() test case.
*/
class BusinessDaysTest extends PHPUnit_Framework_TestCase {
protected function setUp() {
parent::setUp();