Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working on my smart home

Matthias Kleine klein0r

🏠
Working on my smart home
View GitHub Profile
@tobi-pb
tobi-pb / archive.php
Created Nov 2, 2015
Repack Magento Extension after running `tar xfvz extension.tgz`
View archive.php
<?php
require_once 'abstract.php';
//
//
// PLEASE SET EDIT packages.xml and update md5 hashes!
class Mage_Shell_Archive extends Mage_Shell_Abstract
{
@mam08ixo
mam08ixo / data-upgrade-0.1.67-0.1.68.php
Last active Oct 30, 2015 — forked from avoelkl/upgrade-0.1.67-0.1.68.php
SUPEE-6788 variable + block setup script. 1.) Create a new module or extend a current one. 2.) Create a new install or setup script with the variables and blocks which are not whitelisted yet.
View data-upgrade-0.1.67-0.1.68.php
<?php
/**
* @category Namespace
* @package Namespace_Module
* @author Anna Völkl
* @author Christoph Aßmann
* @author Fabian Schmengler
*/
/** @var Mage_Core_Model_Resource_Setup $installer */
@rfox90
rfox90 / clock.cgi
Created Oct 19, 2015
Simple example of an lametric endpoint in perl.
View clock.cgi
#!/usr/bin/perl -w
use strict;
use CGI;
use CGI::Carp qw(fatalsToBrowser);
use JSON;
my $json = JSON->new->pretty->allow_nonref;
my $q = CGI->new;
View SupportDesk_FixAcl.php
<?php
/**
* SupportDesk_FixAcl.php v1.1
* SupportDesk (www.supportdesk.nu)
* 10/7/2015
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* It is available through the world-wide-web at this URL:
@tjamps
tjamps / README.md
Last active Feb 19, 2021
Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle
View README.md

Basic RESTful API with Symfony 2 + FOSRestBundle (JSON format only) + FOSUserBundle + FOSOauthServerBundle

The API we are creating in this gist will follow these rules :

  • The API only returns JSON responses
  • All API routes require authentication
  • Authentication is handled via OAuth2 with password Grant Type only (no need for Authorization pages and such).
  • API versioning is managed via a subdomain (e.g. v1.api.example.com)

The API will be written in PHP with the Symfony 2 framework. The following SF2 bundles are used :

@ScreamingDev
ScreamingDev / sendmail
Last active Jul 12, 2016
PHP local send mail (/usr/local/bin/sendmail)
View sendmail
#!/usr/bin/php
<?php
$input = file_get_contents('php://stdin');
preg_match('|^To: (.*)|', $input, $matches);
$filename = tempnam('/var/log/mail', date('ymd-his-') . $matches[1] . '.');
file_put_contents($filename, $input);
@messageagency
messageagency / pconnect.sh
Last active Mar 30, 2021
Pantheon DB Connection Script
View pconnect.sh
#!/bin/sh
# exit on any errors:
set -e
if [ $# -lt 1 ]
then
echo "Usage: $0 @pantheon-alias"
exit 1
fi
@upvalue
upvalue / amazon.rb
Last active Dec 23, 2016
Amazon affiliate filters for jekyll.
View amazon.rb
# amazon.rb - amazon affiliate links for jekyll
# assumes that you have a configuration variable called 'amazon_associate_id' with your associate id
# usage: {{ asin | amazon_product_href }}
# returns url of a product
# usage: {{ asin | amazon_image_href: 'M' }}
# returns image of the product, size argument can be S, M, or L, default M
# usage: {{ asin | amazon_product: 'A Product' }}
@KartikTalwar
KartikTalwar / Documentation.md
Last active Aug 2, 2021
Rsync over SSH - (40MB/s over 1GB NICs)
View Documentation.md

The fastest remote directory rsync over ssh archival I can muster (40MB/s over 1gb NICs)

This creates an archive that does the following:

rsync (Everyone seems to like -z, but it is much slower for me)

  • a: archive mode - rescursive, preserves owner, preserves permissions, preserves modification times, preserves group, copies symlinks as symlinks, preserves device files.
  • H: preserves hard-links
  • A: preserves ACLs
@roderik
roderik / .travis.yml
Last active Jan 30, 2020
Installing Apache with PHP in Travis-CI
View .travis.yml
language: php
php:
- 5.3
- 5.4
before_script:
- sudo apt-get install apache2
- sudo a2enmod actions
- sudo a2enmod rewrite