Skip to content

Instantly share code, notes, and snippets.

-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.11 (GNU/Linux)
owFtkntQVFUcx3cXeYXITjIS1RKtOAyy7Jxz35dJUQJshMI/KENG1nPvPXe5PHbX
fQWDmNiDoZympmAtQs0clCGYcCSKVwmFSAl/6EQqZNSMSuIENGBGZPcy9HCmc/45
5/w+53t+39/vvBkZpAvTJzif1X+BPjbpv54SdHnZfrbSLDilCnNqpVksVbDDq60c
qAybU80luEJAHmxVnPEOp4StxZ74FcZi9mO3R3E6VApYWSthrrJouHZZVhx27Ha5
FU3LjHiWFimBRYCANEURQCIZgHmCoBiZpgEUAQMFACVVssjp8d73qnlZ06ZI6qnK
Z2n8kyqfDmCGGvMtBzCLOZICPOAEhmQICEVEQIkggURzJAGABnqwe8WS06VoqZZh
d0kptrmdzmW/olfRopCCFEFCmmfVZJCnSOVpHgIOA4x4JDCswEKelCiJI0VRYDCQ
@opi
opi / gist:cceecf9602013e3f4135
Last active August 29, 2015 14:07
YNH Poodle

YunoHost Poodle battle plan

## Dovecot

File : /etc/dovecot/dovecot.conf
Add :

ssl_protocols = !SSLv2 !SSLv3

and service dovecot restart

#!/bin/bash
# Download drush if needed
if [ ! -d drush ]
then
# Download
wget https://github.com/drush-ops/drush/archive/6.4.0.tar.gz
# Unpack
tar xvzf 6.4.0.tar.gz
# Rename
@opi
opi / gist:9408c9f03b1400f8c4df
Created August 14, 2014 19:29
I call it art
// Generate a random DOM.
// http://twitter.com/cowboy/status/65845594400362496
(function(s,n){while(n--){s.push($('<div/>').appendTo(s[~~(Math.random()*(s.length-1))]))}})(['body'],10000);
// Cycle bg, starting at a random color.
(function(time){
var start = Math.floor(Math.random() * time);
var dec = "animation: bgcolors -" + start + "s " + time + "s linear infinite;";
var html = "<style>html{-webkit-" + dec + dec + "}</style>";
$("head").append(html);
@opi
opi / ynh_ssl_gandi.md
Created June 4, 2014 17:50
Yunohost: SSL with a Gandi certificate

# SSL with a Gandi certificate

Generer la csr (http://wiki.gandi.net/fr/ssl/csr)

openssl req -nodes -newkey rsa:2048 -keyout monserveur_encrypted.key -out serveur.csr

( n'oubliez pas d'entrer une passphrase pour securiser votre clé privée. )

Gandi renvoye 2 fichiers:

@opi
opi / ynh_nginx_ssl.md
Last active August 29, 2015 14:01
Experimental Nginx config that will give you an A+ grade on ssllabs.com.

# Yunohost Nginx fine tuning

Experimental Nginx config that will give you an A+ grade on ssllabs.com.

Most of this config could be merged into yunohost default, except the dhparam.pem file creation, because it takes too much time.

Generate dh2048.pem

openssl dhparam -out /etc/ssl/private/dh2048.pem -outform PEM -2 2048
<?php
/**
* Implements hook_entity_info_alter().
*/
function MYMODULE_entity_info_alter(&$entity_info) {
$entity_info['node']['view modes']['another_teaser'] = array(
'label' => t('Another teaser'),
'custom settings' => TRUE,
);
<?php
function THEME_html_head_alter(&$head_elements) {
$head_elements['system_meta_generator']['#attributes']['content'] = "Drupal 8 (http://drupal.org)";
}
@opi
opi / gist:8470954
Created January 17, 2014 10:08
Drupal 7 Search language and content type
<?php
/**
* Implements of hook_query_node_access_alter().
*/
function MYMODULE_query_node_access_alter(QueryAlterableInterface $query) {
$search = FALSE;
$node = FALSE;
foreach ($query->getTables() as $alias => $table) {
@opi
opi / gist:8438657
Created January 15, 2014 15:50
touch event js
/**
* Touch events
*/
wrapper.touch = {}
wrapper.get(0).ontouchstart = function(e) {
// Store start position
wrapper.touch.x = e.touches[0].clientX;
};