Skip to content

Instantly share code, notes, and snippets.

View laurentsab's full-sized avatar

Laurent Sabatier laurentsab

View GitHub Profile
@laurentsab
laurentsab / gist:11205884
Created April 23, 2014 07:43
Import SQL Dump in ddb
mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
@laurentsab
laurentsab / symlinks
Last active September 1, 2016 08:55
Symlinks foldersAndFiles: origin -> destination
@laurentsab
laurentsab / symlinks_delete_all
Created May 14, 2014 10:01
Delete All Symlinks
@laurentsab
laurentsab / search_running_process_&_kill
Created June 30, 2014 12:16
Search running process and kill'em all
# search apache running process
$ ps fax | grep apache
4818 pts/0 S+ 0:00 | | | \_ grep --color=auto apache
1541 ? Ss 0:00 /usr/sbin/apache2 -k start
2817 ? S 0:03 \_ /usr/sbin/apache2 -k start
....
# kill process
$ sudo kill 1541
@laurentsab
laurentsab / Git Tips
Last active November 8, 2016 08:32
Git Tips
// Ajouter un submodule
$ git submodule add -b [branch] [ssh gitRepo] [destination folder]
// Annuler toutes les modifs et reviens au commit demandé.
$ git reset --hard [#commit]
// Delete a locale branch
$ git branch -D bugfix
Deleted branch bugfix (was 2a14ef7).
rsync -uvr --no-t --no-p --no-g login@server.com:/folder/to/download/* ./
@laurentsab
laurentsab / ez4_tips
Last active August 29, 2015 14:17
eZ Publish 4 - Tips
/* Afficher une image */
<img src="{$node.object.data_map.my_image.content[image_size].full_path}" ... />
/* Afficher le contenu d'un bloc XML */
{$node.object.data_map.my_xml.content.output.output_text}
/* Afficher un timestamp au format souhaité */
{$node.data_map.date_from.data_int|datetime(custom, '%l %d %F %Y')}
custom, '%d/%m/%y'
@laurentsab
laurentsab / MongoDB Tips
Last active August 29, 2015 14:19
MongoDB Tips
// Update/Add a new field
Rooms.update({_id: 'XDhybphgkdC7Z4dsn'}, {$set: {user: 'Laurent'}});
// Add array
Rooms.update({_id: 'XDhybphgkdC7Z4dsn'}, {$set: {objects: ['TV', 'Radio', 'Draps'] } } );
// Push a field in an array
Rooms.update({_id: 'XDhybphgkdC7Z4dsn'}, {$push: {objects: ['Lights'] } } );
// Push an array in an array
@laurentsab
laurentsab / Shell Tips
Last active February 18, 2017 04:29
Shell Tips
# Show size of each folder
$ du -sch * | sort -h
# Count number of files in a folder
$ find . -name \* | wc -l
# Search a file (or pattern) and execute a command (rm here)
$ find . -name ’*.yml’ -exec rm {} ;
# Add a line at the end of a file
@laurentsab
laurentsab / hyperion_raspberry_commands
Created July 29, 2015 16:55
Hyperion Raspberry commands
// config file
# vi /storage/.config/hyperion.config.json
// restart service
# /bin/sh /storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json