Skip to content

Instantly share code, notes, and snippets.

@ukautz
ukautz / bitbucket-pipelines.yml
Last active October 17, 2019 21:12
Example: BitBucket Pipelines vs fortrabbit
image: php:7.1.1
pipelines:
default:
- step:
script:
- apt-get update && apt-get install -y unzip git rsync
- curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
- composer install
- php deploy.php
@ukautz
ukautz / memcached-demo.php
Created February 16, 2017 11:36
Tuning memcached options for redundancy & fast failover
<?php
$servers = [
['10.0.0.1', 11211],
['10.0.0.1', 11212],
];
$id = 1;
$timeout = 50;
$mc = new \Memcached($id);
@ukautz
ukautz / main.py
Created December 29, 2016 15:46
Blynk vs Particle Photon vs Wifi
###############################################################################
# Hello ZERYNTH
#
# Created by ZERYNTH Team 2015 CC
# Authors: G. Baldi, D. Mazzei
###############################################################################
# import the streams module, it is needed to send data around
import streams
import requests
@ukautz
ukautz / s3-in-laravel.php
Last active August 26, 2022 14:44
Using S3 client directly in Laravel
<?php
/** @var \Illuminate\Filesystem\FilesystemAdapter $fs */
$fs = \Storage::disk('object_storage');
/** @var \League\Flysystem\Filesystem $driver */
$driver = $fs->getDriver();
/** @var \League\Flysystem\AwsS3v3\AwsS3Adapter $adapter */
$adapter = $driver->getAdapter();
@ukautz
ukautz / test.php
Last active August 9, 2016 10:42
Stream S3 images
<?php
// composer require aws/aws-sdk-php ">=3"
require_once __DIR__ . "/vendor/autoload.php";
$key = '{{your-aws-s3-key}}';
$secret = '{{your-aws-s3-secret}}';
$region = '{{your-aws-s3-region}}';
$bucket = '{{your-aws-s3-bucket}}';
@ukautz
ukautz / hooks.php
Created August 4, 2016 16:14
CodeIgniter 3 - Delegate exceptions and errors to Logentries
<?php
// application/config/hooks.php
defined('BASEPATH') OR exit('No direct script access allowed');
/*
| -------------------------------------------------------------------------
| Hooks
| -------------------------------------------------------------------------
| This file lets you define "hooks" to extend CI without hacking the core
@ukautz
ukautz / MY_Log.php
Created July 26, 2016 18:23
Code Igniter Logging
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
// Store in `application/libraries/MY_Log.php`
// this class is adapted from system/libraries/Log.php
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
@ukautz
ukautz / freeze-glide-versions.pl
Last active July 31, 2016 13:13
Perl script to insert all versions from glide.lock into glide.yaml for app unversioned packages
#!/usr/bin/perl
#
# Freezes all versions found in glide.lock by setting commiot as version in glide.yaml
# for each package which does not explicitly has a version
#
use strict;
use warnings;
@ukautz
ukautz / README.md.patch
Created June 13, 2016 14:23
Update for README to contain endpoint
diff --git a/README.md b/README.md
index b971bc8..0c1a433 100644
--- a/README.md
+++ b/README.md
@@ -40,11 +40,13 @@ $schemes = [
'StorageClass' => 'REDUCED_REDUNDANCY',
],
- 'protocol' => 'https', // Will be autodetected based on the current request.
+ 'protocol' => 'https', // Will be autodetected based on the current request.
@ukautz
ukautz / cert_load.go
Created March 2, 2016 18:55
Go: Load all .pem files containing private key and certificate(s) from directory
package common
import (
"crypto"
"crypto/ecdsa"
"crypto/rsa"
"crypto/tls"
"crypto/x509"
"encoding/pem"
"fmt"