Skip to content

Instantly share code, notes, and snippets.

@eckelon
eckelon / gitignore.sh
Created October 25, 2016 19:45
convenient way of creating a .gitignore file using gitignore.io API.
function gi() {
curl -L -s https://www.gitignore.io/api/$@ >> .gitignore;
}
@eckelon
eckelon / terminalvim.applescript
Created October 25, 2016 19:33
adaptación del script de http://thepugautomatic.com/2015/02/open-in-iterm-vim-from-finder/ para abrir ficheros en vim + iterm2 desde el Finder o abrir una vim + iterm2 en blanco
on run {input, parameters}
if input is equal to {} then
set cmd to "clear;cd `/Users/jasamitier`;vim "
else
set filename to POSIX path of input
set cmd to "clear;cd `dirname " & filename & "`;vim " & filename
end if
tell application "iTerm"
@eckelon
eckelon / javaCoalesce.java
Last active March 9, 2017 16:13
silly way for avoiding the use of massive ternary operators in Java
public static <T> T coalesce(T object) {
return object == null ? null : object;
}
public static <T> T coalesce(T find, T replace) {
return find == null ? replace : find;
}
@eckelon
eckelon / batchImageOptim.sh
Last active October 30, 2017 16:24
I wrote this script to compress a very heavy project images folder. It works with jpg and png. It worked for me, but it may need some modifications to solve your problem
#!/bin/bash
#this script was written to be called with find, something like:
# find . -type f \( -name *.jpg -o -name *.png -o -name *.JPG -o -name *.PNG \) -exec ~/batchImageOptim.sh "{}" \;
if [[ $# == 1 ]]; then
input_file="$1"
else
echo "no arguments, no party"
exit 255
@eckelon
eckelon / grepafterfind.sh
Created December 18, 2017 12:02
pipe grep search to find result
find ~ -type f -name '*.log' -exec grep 'text' -l {} \; > output.txt
@eckelon
eckelon / mage2_foler_file_permissions.md
Created March 13, 2018 09:09 — forked from evgv/mage2_foler_file_permissions.md
Magento 2 folder/file permissions

Magento 2 folder/file permissions

  • The owner of the Magento file system: Must have full control (read/write/execute) of all files and directories.
  • Must not be the web server user; it should be a different user.
  • The web server user must have write access to the following files and directories: var app/etc pub
  • In addition, the web server's group must own the Magento file system so that the Magento user (who is in the group) can share access to files with the web server user. (This includes files created by the Magento Admin or other web-based utilities.)
We recommend setting the permissions as follows:
All directories have 770 permissions.
@eckelon
eckelon / vagrantfile-rsync-conf.rb
Created March 26, 2018 15:15
My shared folders configuration for Vagrant using Rsync instead of nfs to have a much better performance on Mac OS
config.vm.synced_folder '.', '/var/www',
type: 'rsync',
rsync__exclude: [
'Vagrantfile', # Vagrant control file
'.vagrant/', # Vagrant work area
'.git/', # Git repository
'.gitignore', # Git support file
'.gitattributes', # Git support file
'foo/media/images', # other folders you don't want to be wiped with the host contents
'vendor/' # other folders you don't want to be wiped with the host contents
@eckelon
eckelon / jack-different-output-device.sh
Created March 30, 2018 17:03
Simple snippet that enables jack to use a second audio device for output
alsa_out -j "Xmod" -d hw:Xmod -q 1 2>&1 1> /dev/null &