Skip to content

Instantly share code, notes, and snippets.

View thiagozs's full-sized avatar
:octocat:
Have a nice day

Thiago Zilli Sarmento thiagozs

:octocat:
Have a nice day
View GitHub Profile
@thiagozs
thiagozs / siteScreenShot.sh
Created April 24, 2014 14:56
ScreenShot website linux command line
#!/bin/bash
cutycapt --url=$1 --out=$2 --min-height=1680 --min-width=1050 --js-can-open-windows=on --print-backgrounds=on --delay=2000 --user-agent="Mozilla/5.0 (Windows NT 5.1; rv:31.0) Gecko/20100101 Firefox/31.0"
@thiagozs
thiagozs / rename_linux_command.txt
Created April 28, 2014 17:19
rename linux batch files
rename 's/OLD/NEW/' FILES
rename 's/picture/image/' picture*.jpg
@thiagozs
thiagozs / FileController.js
Last active August 29, 2015 14:08
Upload Sails
/**
* FileController
*
* @description :: Server-side logic for managing files
* @help :: See http://links.sailsjs.org/docs/controllers
*/
var async = require('async');
module.exports = {
@thiagozs
thiagozs / fakes3.sh
Created October 31, 2014 20:25
FakeS3 Amazon
#!/bin/sh
### BEGIN INIT INFO
# Provides: fakes3
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# 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.
@thiagozs
thiagozs / node-version-manager.txt
Created January 6, 2015 16:21
Instalador do NVM
curl https://raw.githubusercontent.com/creationix/nvm/v0.16.1/install.sh | sh
source ~/.profile
nvm ls-remote
nvm install 0.11.14
nvm alias default 0.11.14
@thiagozs
thiagozs / redisExpireTTl.sh
Created March 27, 2015 15:41
Simple shell Expire Time for Redis
#!/bin/bash
HOUR=3600
REDISCLI=/home/zilli/redis/redis-cli
HOST=10.0.0.125
$REDISCLI -h $HOST KEYS "$1" |
while read LINE;
do
echo "SET EXPIRE $LINE";
@thiagozs
thiagozs / imagemagick.js
Created April 27, 2015 20:01
POC imagemagick for resize and change name of images
var S = require('string');
var moment = require('moment');
var util = require('util');
var im = require('node-imagemagick');
var _ = require("underscore");
var sizes = [{
width: 200,
name: '-small'
}, {
@thiagozs
thiagozs / searchviews.js
Created May 4, 2015 18:26
Sailsjs estudo com moment e range de data
var moment = require('moment');
//esta semana
var week = moment().week();
var startweek = moment().startOf('week').format("YYYY-MM-DD");
var endweek = moment().endOf('week').format("YYYY-MM-DD");
//semana passada
var week = moment().subtract(1, 'weeks').week();
var laststartweek = moment().subtract(1, 'weeks').startOf('week').format("YYYY-MM-DD");
@thiagozs
thiagozs / dns.sh
Created June 22, 2015 14:05
show DNS
#!/bin/bash
nm-tool | grep DNS
@thiagozs
thiagozs / genpasswd.sh
Created September 22, 2015 17:13
Password Generator Bash
#!/bin/bash
genpasswd() {
local l=$1
[ "$l" == "" ] && l=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${l} | xargs
}
genpasswd