Skip to content

Instantly share code, notes, and snippets.

View ClaudioVarandas's full-sized avatar

Cláudio Varandas ClaudioVarandas

  • Lisbon Portugal
  • 00:02 (UTC +01:00)
View GitHub Profile
@ClaudioVarandas
ClaudioVarandas / vag_centos_lamp.sh
Created May 30, 2017 14:04
Vagrant centos lamp
#!/usr/bin/env bash
sudo yum -y update
sudo yum -y install epel-release
sudo yum -y install wget vim
setenforce 0
sed -i 's/SELINUX=\(enforcing\|permissive\)/SELINUX=disabled/g' /etc/selinux/config
@ClaudioVarandas
ClaudioVarandas / vag_centos_lamp.sh
Created May 30, 2017 14:04
Vagrant centos lamp
#!/usr/bin/env bash
sudo yum -y update
sudo yum -y install epel-release
sudo yum -y install wget vim
setenforce 0
sed -i 's/SELINUX=\(enforcing\|permissive\)/SELINUX=disabled/g' /etc/selinux/config
@ClaudioVarandas
ClaudioVarandas / laravel_perm.sh
Created May 30, 2017 14:02
Laravel permissions
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
@ClaudioVarandas
ClaudioVarandas / create_selfsigned_fedora.sh
Created May 4, 2017 09:26
Create a Self-Signed Certificate Fedora
#Issue the following command to generate your self-signed certificate.
#Change example.com to reflect the fully qualified domain name (FQDN) of the site you intend to use with SSL:
#1
openssl req -new -x509 -sha256 -days 365 -nodes -out /etc/pki/tls/certs/example.com.crt -keyout /etc/pki/tls/private/example.com.key
#This command creates a .crt file under the /etc/pki/tls/certs directory, and a .key file under /etc/pki/tls/private using these options:
#-nodes instructs OpenSSL to create a certificate that does not require a passphrase. If this option is excluded, you will be required to enter the the passphrase in the console each time the application using it is restarted.
#-days determines the length of time in days that the certificate is being issued for. For a self-signed certificate, this value can be increased as necessary.
#-sha256 ensures that the certificate request is generated using 265-bit SHA (Secure Hash Algorithm).
@ClaudioVarandas
ClaudioVarandas / dom-helper.js
Created March 31, 2017 07:41 — forked from SitePointEditors/dom-helper.js
Mini jQuery, sort of.
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
@ClaudioVarandas
ClaudioVarandas / dom-helper.js
Created March 31, 2017 07:40 — forked from SitePointEditors/dom-helper.js
Mini jQuery, sort of.
/**
* A collection of helper prototype for everyday DOM traversal, manipulation,
* and event binding. Sort of a minimalist jQuery, mainly for demonstration
* purposes. MIT @ m3g4p0p
*/
window.$ = (function (undefined) {
/**
* Duration constants
* @type {Object}
@ClaudioVarandas
ClaudioVarandas / fedora_25_lamp.sh
Last active March 27, 2017 16:08
Fedora 25 lamp
####Mysql 5.7
## Fedora 25 ##
MariaDb 10.1
#Fedora 25 provides PHP version 7.0 in its official repository
#Command to install the Remi repository configuration package:
dnf install http://rpms.remirepo.net/fedora/remi-release-25.rpm
#You want multiple versions which means using a Software Collection
@ClaudioVarandas
ClaudioVarandas / git.sh
Created March 8, 2017 10:03
Git tricks
#How to prune local tracking branches that do not exist on remote anymore
git branch -r | awk '{print $1}' | egrep -v -f /dev/fd/0 <(git branch -vv | grep origin) | awk '{print $1}' | xargs git branch -d
@ClaudioVarandas
ClaudioVarandas / Drupal lang negotiation my.module
Last active March 8, 2017 10:01
hook_language_negotiation_info for custom provider
/**
* Implements hook_language_negotiation_info().
*/
function nap_language_negotiation_info() {
return array(
'nap_language_provider' => array(
'callbacks' => array(
'language' => 'MODULE_language_provider_callback',
'switcher' => 'MODULE_language_switcher_callback',
'url_rewrite' => 'MODULE_language_url_rewrite_callback',
@ClaudioVarandas
ClaudioVarandas / module.locale.inc
Created January 25, 2017 12:26
Drupal language custom provider
<?php
/**
* @file
* Handles localization for module.
*/
/**
* Language callback for selecting the active language.