Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if test $# -lt 1 ; then
echo "Usage: download_apk.sh <target-dir>"
exit 1
fi
for LINE in $(adb shell pm list packages -f -3|sed 's/package://g'); do
APK_PATH=$(echo "$LINE" | cut -d'=' -f1)
FILE=$1/$(echo "${LINE}" | cut -d'=' -f2 | sed 's/\r$//').apk
<!-- /etc/firewalld/zones/docker.xml -->
<zone>
<short>Docker</short>
<description>Permits docker containers to access eachother.</description>
<interface name="docker0" />
<rule family="ipv4">
<source address="172.17.0.0/16" />
<accept/>
</rule>
</zone>
{
"minimum-stability": "stable",
"require": {
"cakephp/cakephp": "2.6.8"
},
"config": {
"vendor-dir": "Vendor"
},
"require-dev": {
"cakephp/debug_kit": "2.2.x-dev"
#!/usr/bin/env php
<?php
class Person
{
public $first_name;
public $last_name;
public function getFullName()
{
@adduc
adduc / gist:5fbd7185441c8b9543f6
Created December 11, 2014 20:41
PHP Opcache Not Refreshing
The opcache for PHP (previously Zend Optimizer+) depends on the filemtime to identify when to reinterpret the opcode for a file. If a file is changed, the system's clock is changed back (through NTP or other means), any changes to the file up until the previously set date/time will not be caught by the opcache.
@adduc
adduc / replace-short-tags.php
Created September 29, 2014 07:38
Short open tag
<?php
/**
* find -name "*.php" -exec php -d short_open_tag=On replace-short-tags.php {} \
*/
if(!isset($argv[1])) {
fwrite(STDERR, 'ch');
exit(1);
}
<?php
/* Emulate register_globals behavior:
*
* @see http://php.net/manual/en/ini.core.php#ini.variables-order
*
* If variables_order is set to "EGPCS", and both $_GET['action'] and
* $_POST['action'] are set, then $action will contain the value of
* $_POST['action'] as P comes after G in our example directive value.
*
* @param bool $include_session Whether to register session variables or not.
@adduc
adduc / gist:8907811
Created February 9, 2014 23:34
Logwatch for PHP excluding referer information
#!/usr/bin/perl -w
#
# $Id$
#
# Logwatch service for php error logs
# To be placed in
# /etc/logwatch/scripts/php
#
# Processes all messages and summarizes them
# Each message is given with a timestamp and RMS
@adduc
adduc / gist:7489154
Last active December 28, 2015 10:49
Phing target for detecting PHP short open tags.
<target name="checkshorttags">
<!-- Run in parallel to speed up process. -->
<exec
escape="false"
command='GREPOUT=`find . -not -ipath "*vendor*" -type "f" -name "*.php" -print0 | xargs -0 -n1 -P$(nproc) pcregrep -nrHMe "&lt;\?\s"`;
echo "$GREPOUT";
if [ -z "$GREPOUT" ];
then exit 0;
else exit 1;
fi;