среда, 16 сентября 2015 г.

Apple Certificates to PEM

p12 => pem
openssl pkcs12 -in Certificates.p12 -out push.prod.crt.pem -nodes -clcerts

bin crt => pem
openssl x509 -inform der -in aps_production.cer -outform pem -out certificate.pem


While trying to update a certificate on a produciton enviroment I ran into the following issue, Apache only accepts certificates in PEM format, since my client provided me with his new certificate on a .cer file I had to find a way to convert it.
For x509 certificates this can be easily achieved using OpenSSL on Linux/Unix and OS X. First make sure you have OpenSSL (comes by default with OS X), open a terminal and issue the following command:
openssl x509 -inform pem -in certificate.cer -outform der -out certificate.pem
Where certificate.cer is the source certificate file you want to convert and certificate.pem is the name of the converted certificate.

The inform and outform options are reversed. The command should be:
openssl x509 -inform der -in certificate.cer -outform pem -out certificate.pem

https://github.com/richsage/RMSPushNotificationsBundle/issues/60#issuecomment-40174938
http://perrohunter.com/how-to-convert-a-cer-certificate-to-pem-on-linuxunix-and-os-x/#comment-4398

четверг, 6 августа 2015 г.

Drupal Dump Field Declaration

include_once DRUPAL_ROOT . '/includes/utility.inc';
$field_data = field_info_field('field_testimonial_portrait');
unset($field_data['id']);
pre(drupal_var_export($field_data));


$instance_data = field_info_instance('node', 'field_testimonial_portrait', 'testimonial');
unset($instance_data['id'], $instance_data['field_id']);
pre(drupal_var_export($instance_data));

Inspired by http://www.thecarneyeffect.co.uk/creating-custom-content-type-adding-fields-programmatically-drupal-7


include_once DRUPAL_ROOT . '/includes/utility.inc';
$field_data = field_info_field('field_specialty');
unset($field_data['id']);
echo "
" . (drupal_var_export($field_data)) . '
';


$instance_data = field_info_instance('node', 'field_specialty', 'doctor_cv');
unset($instance_data['id'], $instance_data['field_id']);
echo "
" . (drupal_var_export($instance_data)) . '
';

среда, 5 августа 2015 г.

Drupal Mudule Translation

  1. To generate the .pot file, install the module Translation template extractor
  2. Go to the "Extract strings" tab on the Locale administration interface, select your module and submit the form. You will get one single template file generated.
  3. Then you can translate the strings with a tool like Poedit (http://www.poedit.net).
  4. When you are done, files should be copied to a "translations" sub-folder in the module folder, so they are automatically imported by Drupal when installing your game module.

drush command to force translations loading: drush php-eval "locale_system_update(array('yourmodule_name'));drush_backend_batch_process();"

понедельник, 27 июля 2015 г.

Get Folders Sizes

du -chs ./*



0       ./proc
654M    ./root
232K    ./run
5.6M    ./sbin
4.0K    ./selinux
3.3G    ./sites
4.0K    ./srv
0       ./sys
4.1M    ./tmp
435M    ./usr
860M    ./var
0       ./vmlinuz
13M     ./work

четверг, 4 июня 2015 г.

Microsoft Visual Studio Emulators

Microsoft Visual Studio Emulator for Android :
http://go.microsoft.com/fwlink/?LinkID=530049
or
http://go.microsoft.com/fwlink/?LinkID=532868
190000000
500000000
http://go.microsoft.com/fwlink/?LinkID=517148


Emulators for Windows Mobile 10.0.10069
http://go.microsoft.com/fwlink/?LinkID=532802
 1084376
 2026385408

%programfiles(x86)%\Windows Kits\10\Emulation\Mobile\10.0.1.0\flash.vhd


http://codeshake.net/use-visual-studio-android-emulator-android-studio/


ToolsForWin81_WP80_WP81
WindowsPhone81Emulators

среда, 6 мая 2015 г.

Druapl 7 locale DOMAIN with Port

change includes/locale.inc

function locale_language_url_rewrite_url(&$path, &$options) {
  static $drupal_static_fast;
  if (!isset($drupal_static_fast)) {
    $drupal_static_fast['languages'] = &drupal_static(__FUNCTION__);
  }
  $languages = &$drupal_static_fast['languages'];

  if (!isset($languages)) {
    $languages = language_list('enabled');
    $languages = array_flip(array_keys($languages[1]));
  }

  // Language can be passed as an option, or we go for current URL language.
  if (!isset($options['language'])) {
    global $language_url;
    $options['language'] = $language_url;
  }
  // We allow only enabled languages here.
  elseif (!isset($languages[$options['language']->language])) {
    unset($options['language']);
    return;
  }

  if (isset($options['language'])) {
    switch (variable_get('locale_language_negotiation_url_part', LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX)) {
      case LOCALE_LANGUAGE_NEGOTIATION_URL_DOMAIN:
        if ($options['language']->domain) {
          // Ask for an absolute URL with our modified base_url.
          global $is_https;
          $url_scheme = ($is_https) ? 'https://' : 'http://';
          $options['absolute'] = TRUE;

          // Take the domain without ports or protocols so we can apply the
          // protocol needed. The setting might include a protocol.
          // This is changed in Drupal 8 but we need to keep backwards
          // compatibility for Drupal 7.
          $host = 'http://' . str_replace(array('http://', 'https://'), '', $options['language']->domain);
          $port = parse_url($host, PHP_URL_PORT);
          $host = parse_url($host, PHP_URL_HOST);

          // Apply the appropriate protocol to the URL.
          $options['base_url'] = $url_scheme . $host . ($port?(80==$port?'':':'.$port):'');
          if (isset($options['https']) && variable_get('https', FALSE)) {
            if ($options['https'] === TRUE) {
              $options['base_url'] = str_replace('http://', 'https://', $options['base_url']);
            }
            elseif ($options['https'] === FALSE) {
              $options['base_url'] = str_replace('https://', 'http://', $options['base_url']);
            }
          }
        }
        break;

      case LOCALE_LANGUAGE_NEGOTIATION_URL_PREFIX:
        if (!empty($options['language']->prefix)) {
          $options['prefix'] = $options['language']->prefix . '/';
        }
        break;
    }
  }
}

среда, 1 апреля 2015 г.

Clear chrome downloads history using chrome console

var x = document.getElementsByClassName('control-remove-link'); for (i in x){if(x[i].click)
{x[i].click()}}

Chrome 46+
var x = document.getElementsByClassName('remove'); for (i in x){if(x[i].click){x[i].click()}}