Skip to content

Instantly share code, notes, and snippets.

@odracci
odracci / slack.py
Created July 3, 2018 08:49 — forked from boxysean/slack.py
PythonSlackOperator -- how I've integrated notifications into my PythonOperators
# airflow/plugins/slack.py
import logging
from airflow.operators.python_operator import PythonOperator
from airflow.plugins_manager import AirflowPlugin
from slackclient import SlackClient
from titan.utils import config
<?php $time_start = microtime(true);
// Add multiple IPs to blacklist, whitelist or unlist them on Cloudflare using CloudFlare API by AzzA <azza@broadcasthe.net>
// Ed Cooper 2015 - https://blog.ed.gs
// Version 1.0
// Configure your API key and email address below
$cfemailaddress = "your@email.com"; // Cloudflare email address
$cfapikey = "1234123412341234123412341234"; // Cloudflare API key
@odracci
odracci / nginx.conf
Created October 21, 2016 23:48 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@odracci
odracci / pf.md
Created January 2, 2016 16:38 — forked from ryanzhou/pf.md
Getting Pow to work in OS X Yosemite

Getting Pow to work in OS X Yosemite

Some parts taken from: https://gist.github.com/kujohn/7209628

ipfw is officially deprecated and removed in OS X Yosemite. Pow requires another program pf to handle the port forwarding.

1. Anchor file

Create file /etc/pf.anchors/pow

#!/usr/bin/env bash
# Usage: git-branch-status
# Show how many commits each branch is ahead or behind its upstream.
branch=`git rev-parse --abbrev-ref HEAD`
git for-each-ref --format='%(refname:short) %(upstream:short)' refs/heads | \
while read local upstream; do
<?php
namespace Nelmio\HomeBundle\Tests\Controller;
use Nelmio\HomeBundle\Controller\ContactController;
use Liip\FunctionalTestBundle\Test\WebTestCase;
class ContactControllerTest extends WebTestCase
{
public function testEmail()
@odracci
odracci / gist:4356918
Last active December 10, 2015 01:18 — forked from stefanosala/gist:3881637
NameVirtualHost *:80
<VirtualHost *:80>
ServerName dev.lan
ServerAlias *.dev.lan
DocumentRoot /Users/rick/projects/php
<Directory /Users/rick/projects/php>
#AllowOverride All
AllowOverride None
@odracci
odracci / README.markdown
Created November 20, 2012 16:47 — forked from Yavari/README.markdown
Bootstrap's Typeahead plugin extended (allowing for AJAX functionality) among other things

This is a fork of Bootstrap Typeahead that adds minimal but powerful extensions.

For example, process typeahead list asynchronously and return objects

  # This example does an AJAX lookup and is in CoffeeScript
  $('.typeahead').typeahead(
    # source can be a function
    source: (typeahead, query) ->
 # this function receives the typeahead object and the query string
@odracci
odracci / deploy.rb
Created September 26, 2012 22:46 — forked from jakzal/deploy.rb
Updating assets version before assetic dump (capifony)
namespace :symfony do
namespace :assets do
desc "Updates assets version"
task :update_version do
run "sed -i 's/\\(assets_version: \\)\\(.*\\)$/\\1 #{real_revision}/g' #{latest_release}/app/config/config.yml"
end
end
end
before "symfony:assetic:dump" do
@odracci
odracci / TranslatedFieldType.php
Created July 27, 2012 19:40 — forked from pakaufmann/TranslatedFieldType.php
Changed a couple of things. Languages are now dynamic and a default language can be used which won't be written into a translation object but directly into the object itself so it can be used like in this blog post: http://knplabs.fr/blog/I%28blah...blah.
<?php
namespace ExampleBundle\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Edge5\TestProjectBundle\Form\addTranslatedFieldSubscriber;