Skip to content

Instantly share code, notes, and snippets.

@vcarel
vcarel / make_pdf.sh
Created August 19, 2013 23:10
Shell script to generate a PDF file from a large amount of scanned pages.
cd pictures
FILES=$( find . -type f -name "*jpg" | sort -V )
mkdir temp && cd temp
for file in $FILES; do
BASE=$(echo $file | sed 's/.jpg//g');
convert ../$BASE.jpg $BASE.pdf;
done &&
pdftk *pdf cat output ../FINAL_NAME.pdf &&
cd ..
rm -rf temp
@vcarel
vcarel / .gitconfig
Last active December 21, 2015 08:29
Convenient configuration for git.
[color]
ui = true
[core]
editor = vim
[push]
default = simple
[alias]
last = cat-file commit HEAD
cm = commit -a -m\"[refactor] code mort\"
format = commit -a -m\"[refactor] format\"
@vcarel
vcarel / .jshintrc
Last active December 5, 2016 15:35
Bootstrap for static websites with Grunt and Webmake (featuring Stylus, cssmin, htmlmin, jshint...)
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": false,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
@vcarel
vcarel / gulpfile.js
Created October 13, 2014 06:32
Help task for gulp
var gulp = require('gulp');
gulp.task('default', function (done) {
var chalk = require('chalk');
console.log('');
console.log(chalk.bold('Available tasks'));
console.log(chalk.cyan(' build') + ' Build and minify the application.');
console.log(chalk.cyan(' clean') + ' Clean the build directory.');
console.log(chalk.cyan.bold(' default') + ' Display this help.');
console.log(chalk.cyan(' dist') + ' Create a distributable .tar.gz file.');
@vcarel
vcarel / color.js
Last active June 10, 2024 15:59
mongodb shell colored output
function red (text) { return colorize(text, 'red') }
function green (text) { return colorize(text, 'green') }
function yellow (text) { return colorize(text, 'yellow') }
function blue (text) { return colorize(text, 'blue') }
function magenta (text) { return colorize(text, 'magenta') }
function cyan (text) { return colorize(text, 'cyan') }
function gray (text) { return colorize(text, 'gray') }
function colorize(text, color, style) {
// color: 'red', 'green', 'blue'... (see below)
@vcarel
vcarel / color.sh
Created November 24, 2014 14:30
bash colored output
#!/bin/bash
DEFAULT="\e[39m"
RED="\e[31m"
GREEN="\e[32m"
YELLOW="\e[33m"
BLUE="\e[34m"
MAGENTA="\e[35m"
CYAN="\e[36m"
GRAY="\e[37m"
"use strict";
var history = window.history;
var routes = {};
var defaultCallback;
function applyRoutes() {
var callback = routes[document.location.pathname];
if (callback) {