Skip to content

Instantly share code, notes, and snippets.

@moux2003
moux2003 / Entity.php
Created July 16, 2013 08:13
Validate user age
use FOS\UserBundle\Model\User as ModelUser;
use Virgin\UserBundle\Validator\Constraints as VirginAssert;
/**
* Storage agnostic user object
*
* @author Thibault Duplessis <thibault.duplessis@gmail.com>
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class User extends ModelUser
@moux2003
moux2003 / array.js
Created September 3, 2013 16:05
Is value in array
// true if needed is found in list
function ( list, needed ) { return !!~list.indexOf( needed ); }
@moux2003
moux2003 / permissions.sh
Created September 3, 2013 16:07
Set permissions
#!/bin/sh
if [ -d app/cache ]; then rm -rf app/cache/*; fi
if [ -d app/logs ]; then rm -rf app/logs/*; fi
if [ -d app/spool ]; then rm -rf app/spool/*; fi
# source : https://raw.github.com/everzet/dotfiles/master/scripts/chcache
USER=$(whoami)
APACHE_USER=$(ps axho user,comm|grep -E "httpd|apache"|uniq|grep -v "root"|awk 'END {print $1}')
@moux2003
moux2003 / filename.html.twig
Created October 14, 2013 15:22
Acces twig context variables
{% for key, value in _context %}
<li>{{ key }}</li>
{% endfor %}
@moux2003
moux2003 / .gitconfig
Last active May 4, 2021 07:52
git config file
[alias]
# Checkout
co = checkout
# Clean sync remote/local branches
cl = "! git fetch -p && for branch in $(git branch -vv | grep ': disparue]' | awk '{print $1}'); do git branch -D $branch; done"
# View abbreviated SHA, description, and history graph of the latest 20 commits
l = log --pretty=oneline -n 20 --graph --abbrev-commit
#
lg = log --graph --pretty=tformat:'%Cred%h%Creset -%C(cyan)%d %Creset%s %Cgreen(%an %cr)%Creset' --abbrev-commit --date=relative
#
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
@moux2003
moux2003 / phpmyadmin.conf
Created January 28, 2015 22:22
Nginx conf for phpmyadmin
server {
listen 8080;
server_name localhost;
root /home/zareth/phpmyadmin;
location / {
index index.php;
}
## Images and static content is treated different
@moux2003
moux2003 / config.txt
Created March 26, 2015 01:30
Enable SPI on OSMC fo raspberry
# file in /boot/config.txt, need reboot
dtparam=spi=on
@moux2003
moux2003 / keymap.cson
Created December 9, 2015 13:12
Nylas N1
'body':
'cmd-delete': 'application:delete-item'
'delete': 'application:archive-item'
@moux2003
moux2003 / Ssl-Http2-LetsEncrypt.md
Last active October 2, 2016 13:06
LetsEncrypt procedure

Install, configure and automatically renew Let's Encrypt SSL certificate

I've recentelly passed https://vincent.composieux.fr over HTTPS using a Let's Encrypt free SSL certificate so this blog articles will explain you how I've done it, how I also renew the certificate automatically every 60 days and how I've configured my Varnish and Nginx stack.

Let's introduce Let's Encrypt

This initiative is sponsored by the biggest Internet companies and browsers: Google (Chrome), Mozilla (Firefox), Akamai, Facebook, ... so this is widely supported.