Skip to content

Instantly share code, notes, and snippets.

View MarcosBL's full-sized avatar
:octocat:
Github Advocate

MarcosBL MarcosBL

:octocat:
Github Advocate
View GitHub Profile
@MarcosBL
MarcosBL / host_file
Created July 10, 2014 11:38
Nginx header write for serving fonts to firefox cross domain and avoid CORS
location ~* \.(eot|ttf|woff)$ {
add_header Access-Control-Allow-Origin *;
}
### Keybase proof
I hereby claim:
* I am marcosbl on github.
* I am marcosbl (https://keybase.io/marcosbl) on keybase.
* I have a public key whose fingerprint is AF9D 3E27 B3D8 F49E B3AD A4DC 6022 F670 9EFA 042B
To claim this, I am signing this object:
@MarcosBL
MarcosBL / blocks.css
Created April 3, 2014 07:54
Visualise the size of each element on the page
* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }
@MarcosBL
MarcosBL / flv2mp4
Created March 15, 2014 14:23
ffmpeg FLV to MP4 converter with progress bar
#!/bin/bash
####################################################################################
# ffmpeg flv2mp4 converter with progress indicator
# USAGE
# ./flv2mp4 VideoId
# Modify to your own needs
###################################################################################
SCRIPT=flv2mp4
LOG=/var/log/flv2mp4.log
@MarcosBL
MarcosBL / bash_progress_bar.sh
Created March 14, 2014 20:07
Bash progress bar
show_prog_bar() {
local c="$1" # Character to use to draw progress bar
local v=$2 # Percentage 0<= value <=100
local t=$3 # Text before
local pbl=50 # Progress bar length in characters
local r=`expr 100 / $pbl` # Ratio between percentage value and progress bar length
local p="$v%" # Percentage value to display in the middle of progress bar
local l=${#p} # Length of string to display
local pbs="" # Progress bar string
local k=`expr \( $pbl - $l \) / 2` # Position where to substitute in progress bar string
@MarcosBL
MarcosBL / Koding Laravel Setup
Last active August 29, 2015 13:57
Koding Laravel Setup
# Set root
sudo su
# Install Composer
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
# Exit root
exit

MacOS

Download from here:

http://d.pr/f/QE3d

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to:

@MarcosBL
MarcosBL / mysqloptimizator.sh
Created January 20, 2014 17:01
Simple MyISAM tables optimization - Just put it on a cron
#!/bin/bash
# Get a list of all fragmented tables
FRAGMENTED_TABLES="$( mysql -e ';use information_schema; SELECT TABLE_SCHEMA,TABLE_NAME FROM TABLES WHERE ENGINE="MyISAM" AND TABLE_SCHEMA NOT IN ("information_schema","mysql") AND Data_free > 0' | grep -v "^+" | sed 's,\t,.,' )"
for fragment in $FRAGMENTED_TABLES; do
database="$( echo $fragment | cut -d. -f1 )"
table="$( echo $fragment | cut -d. -f2 )"
[ $fragment != "TABLE_SCHEMA.TABLE_NAME" ] && echo "Optimizando $fragment" && mysql -e "USE $database; OPTIMIZE TABLE $table;" > /dev/null
done
@MarcosBL
MarcosBL / issu.sh
Created December 27, 2013 17:52
Download contents from ISSUU in PDF format
TMP_DIR="/tmp/issud/"
TMP_FILE="issuufile"
KONT=1
I_MAGICK=0
TITLE=""
if [ -z "$1" ]; then
echo "Script para descargar documentos de ISSUU"
echo "Usage: `basename $0` URL"
echo ""
@MarcosBL
MarcosBL / sample.sh
Created November 28, 2013 14:36
Descomprimir los tipos de archivos más conocidos desde consola
extract () {
if [ -f $1 ] ; then
case $1 in
*.tar.bz2) tar xjf $1 ;;
*.tar.gz) tar xzf $1 ;;
*.bz2) bunzip2 $1 ;;
*.rar) unrar e $1 ;;
*.gz) gunzip $1 ;;
*.tar) tar xf $1 ;;
*.tbz2) tar xjf $1 ;;