Skip to content

Instantly share code, notes, and snippets.

View luads's full-sized avatar

Luã de Souza luads

  • Immutable
  • Sydney, Australia
View GitHub Profile
@luads
luads / lambda.sh
Last active March 26, 2023 20:42
Replay lambda from DLQ message
function replay_lambda() {
local profile=$1
local fn=$2
sqs_message="initialising..."
dlq_arn=$(aws --profile=$profile lambda get-function --function-name "$fn" | jq -r '.Configuration.DeadLetterConfig.TargetArn')
dlq=$(aws --profile=$profile sqs get-queue-url --queue-name "$(echo ${dlq_arn##*:})" --output=text)
while [ ! -z "$sqs_message" ]; do
0x659E208C44370AA620e7Cd39d29c8dec030Ae94F
@luads
luads / PlainEncoder.php
Created March 23, 2017 23:00
Symfony Serializer Plain PHP Object (stdClass) encoder Raw
<?php
namespace Acme\Serializer\Encoder;
use Symfony\Component\Serializer\Encoder\DecoderInterface;
use Symfony\Component\Serializer\Encoder\EncoderInterface;
class PlainEncoder implements EncoderInterface, DecoderInterface
{
const FORMAT = 'plain';
@luads
luads / php71-yaml.rb
Created December 7, 2016 23:26
PHP 7.1 YAML extension 2.0.0
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php71Yaml < AbstractPhp71Extension
init
desc "YAML-1.1 parser and emitter"
homepage "https://pecl.php.net/package/yaml"
url "https://pecl.php.net/get/yaml-2.0.0.tgz"
sha256 "ef13ff56c184290c025a522bf9ae2e1b3ecc8543c3a5161dd02adec90897a221"
head "https://github.com/php/pecl-file_formats-yaml.git", :branch => "php7"
require File.expand_path("../../Abstract/abstract-php-extension", __FILE__)
class Php71Xdebug < AbstractPhp71Extension
init
desc "Provides debugging and profiling capabilities."
homepage "http://xdebug.org"
url "https://pecl.php.net/get/xdebug-2.4.1.tgz"
sha256 "23c8786e0f5aae67b1e5035972bfff282710fb84c483887cebceb8ef5bbdf8ef"
head "https://github.com/xdebug/xdebug.git"
@luads
luads / playlist-gmusic.py
Last active November 28, 2016 02:30 — forked from Timmmm/lastfm_to_gmusic.py
Imports any playlist into gmusic
#!/usr/bin/env python
# Import any playlist (within the script) to Google Music All Access playlist.
#
# Based on Tim Hutt's script:
# https://gist.github.com/Timmmm/6572592
#
# Instructions:
# 1. Write the playlist down to the file
# 2. Install `gmusicapi` using `pip`: `pip install gmusicapi`
<snippet>
<content><![CDATA[echo "<pre>"; print_r (${1:variable}); die("</pre>");]]></content>
<tabTrigger>dv</tabTrigger>
<scope>source.php</scope>
<description>PHP: debug with print_r</description>
</snippet>
@luads
luads / post-receive.py
Created December 16, 2013 19:55
A post-receive hook to interact with asana tasks, refering the commits with a link to gitlist.
#!/usr/bin/env python
"""
To use this you have to include the task ID on the commit message.
Example: Fixing typo, #9283764018
You can as well close a task within the commit message.
Example: Improving the docs, closes #9823761989
"""
@luads
luads / states.yml
Created April 18, 2013 18:03
YAML com a lista de estados brasileiros
parameters:
states:
AC:
code: AC
state: 'Acre'
AL:
code: AL
state: 'Alagoas'
AM:
code: AM
@luads
luads / DateSinceExtension.php
Created April 12, 2013 20:59
Extensão pro twig exibir quanto tempo passou entre uma data qualquer e a data atual
<?php
namespace Acme\CoreBundle\Twig;
class DateSinceExtension extends \Twig_Extension
{
public function getFilters()
{
return array(
'date_since' => new \Twig_Filter_Method($this, 'dateSince'),