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 / hosts.ps1
Created November 7, 2016 20:21 — forked from markembling/hosts.ps1
Powershell script for adding/removing/viewing entries to the hosts file.
#
# Powershell script for adding/removing/showing entries to the hosts file.
#
# Known limitations:
# - does not handle entries with comments afterwards ("<ip> <host> # comment")
#
$file = "C:\Windows\System32\drivers\etc\hosts"
function add-host([string]$filename, [string]$ip, [string]$hostname) {
@MarcosBL
MarcosBL / remove-crap.ps1
Created July 18, 2016 17:41
Remove Initial Crap from Windows 10
Get-AppxPackage *3dbuilder* | Remove-AppxPackage
Get-AppxPackage *windowscommunicationsapps* | Remove-AppxPackage
Get-AppxPackage *officehub* | Remove-AppxPackage
Get-AppxPackage *skypeapp* | Remove-AppxPackage
Get-AppxPackage *getstarted* | Remove-AppxPackage
Get-AppxPackage *zunemusic* | Remove-AppxPackage
Get-AppxPackage *windowsmaps* | Remove-AppxPackage
Get-AppxPackage *solitairecollection* | Remove-AppxPackage
Get-AppxPackage *bingfinance* | Remove-AppxPackage
Get-AppxPackage *zunevideo* | Remove-AppxPackage
@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 / Mercurial a Git.md
Created January 31, 2016 23:54
Convertir proyectos Mercurial (hg) a Git

Solo una vez, para instalar el conversor:

cd ~
git clone git://repo.or.cz/fast-export.git

Luego creamos un script hg2git para hacernos la vida más cómoda

@MarcosBL
MarcosBL / palabras.txt
Created January 12, 2016 21:01
Palabras bonitas en gallego
Panxoliña
Fervenza
Caxato
Burbulla
Luscofusco
Verxel
Berce
Xeito
Cuspir
Axóuxere
@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 ;;
#! /bin/sh
### BEGIN INIT INFO
# Provides: supervisord
# Required-Start: $remote_fs
# Required-Stop: $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Example initscript
# Description: This file should be used to construct scripts to be
# placed in /etc/init.d.
@MarcosBL
MarcosBL / deploy.rb
Created August 31, 2013 02:48
Capistrano sample
def prompt_with_default(var, default)
set(var) do
Capistrano::CLI.password_prompt "#{var} [#{default}] : "
end
set var, default if eval("#{var.to_s}.empty?")
end
namespace :misc do
desc "Remove problematic packages"
task :remove do
@MarcosBL
MarcosBL / bootstrap-gradient-buttons-back.less
Last active December 21, 2015 09:48
Recover the Bootstrap v2 buttons gradients with this LESS mixin
.pretty-buttons(@color, @background, @text-shadow: none) {
color: @color;
#gradient > .vertical(lighten(@background, 5%), 0%, darken(@background, 5%), 100%);
border-color: darken(@background, 10%);
border-bottom-color: darken(@background, 20%);
text-shadow: @text-shadow;
.box-shadow(inset 0 1px 0 rgba(255, 255, 255, .1));
&:hover,
@MarcosBL
MarcosBL / sort.php
Created August 13, 2013 01:10
Sorting Images based on Exif data
<?php
$filetypes = array('jpg','jpeg','png','gif','bmp','tiff');
$source = './images_unsorted';
$target = './images_sorted';
$iterator = new RecursiveDirectoryIterator($source);
$bytestotal = 0;
$nbfiles = 0;