Skip to content

Instantly share code, notes, and snippets.

View igorcosta's full-sized avatar
:octocat:

Igor Costa igorcosta

:octocat:
View GitHub Profile

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@igorcosta
igorcosta / spinnerremover
Created June 26, 2014 19:12
Eliminate spinner arrows in input type Number
input[type='number'] {
-moz-appearance:textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
-webkit-appearance: none;
}
@igorcosta
igorcosta / clear_number_mask
Created June 27, 2014 18:21
Removing all chars from a masked input and considering only numbers
var str = value.replace(/[^0-9]+/g,'');
return str;
@igorcosta
igorcosta / url_validar
Created July 8, 2014 15:11
Regex para Validar URL
'^(http|https|ftp)\\://([a-zA-Z0-9\\.\\-]+(\\:[a-zA-Z0-9\\.&%\\$\\-]+)*@)*((25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9])\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[1-9]|0)\\.(25[0-5]|2[0-4][0-9]|[0-1]{1}[0-9]{2}|[1-9]{1}[0-9]{1}|[0-9])|([a-zA-Z0-9\\-]+\\.)*[a-zA-Z0-9\\-]+\\.(com|edu|gov|int|mil|net|org|biz|arpa|info|name|pro|aero|coop|museum|[a-zA-Z]{2}))(\\:[0-9]+)*(/($|[a-zA-Z0-9\\.\\,\\?\\+&%\\$#\\=~_\\-]+))*$
@igorcosta
igorcosta / converter_images.bat
Created July 15, 2014 23:04
Convert Images from your Camera SD card into web size pictures for Windows Users
@echo off
echo To use you need imageMagick, you can find at http://www.imagemagick.org/
Set timefmt=%time%
Set timefmt=%TIMEFMT:~0,2%%TIMEFMT:~3,2%%TIMEFMT:~6,2%
Set timefmt=%TIMEFMT: =0%
Set diretorio=temp
Set /p inicio=Image range from:
Set /p fim=Imagem range to:
Set /p diretorio=Which directory, if you leave empty it will create automatically:
if NOT exist %diretorio% ( Set diretorio=%timefmt% mkdir %diretorio%) else (mkdir %diretorio%)
@igorcosta
igorcosta / deploy_bob_war
Last active August 29, 2015 14:05
Deploy bob war file to tomcat for linux users
function dpbob(){
BOB_DIR=/home/igorcosta/dev/bobportalpai
WEBAPPS_DIR=/home/igorcosta/bin/apache-tomcat-8.0.9/webapps
cd ${BOB_DIR}
git stash
git pull origin mock_server
echo "Pull do repositorio feito"
cd ${BOB_DIR}
mvn clean package
if [-d ${WEBAPPS_DIR}/bobportalapi ];then
<script type="text/javascript">
// First let's create an array of JavaScript Date
// objects.
// More info about the Date class:
// http://w3schools.com/js/js_obj_date.asp
var dates = [
new Date(2010, 4, 10, 10, 07, 16),
new Date(2010, 4, 8, 9, 16, 09),
new Date(2010, 3, 30, 0, 15, 49),
@igorcosta
igorcosta / designer.html
Last active August 29, 2015 14:08
designer
<link rel="import" href="../core-scaffold/core-scaffold.html">
<link rel="import" href="../core-header-panel/core-header-panel.html">
<link rel="import" href="../core-menu/core-menu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-icon-button/core-icon-button.html">
<link rel="import" href="../core-toolbar/core-toolbar.html">
<link rel="import" href="../paper-input/paper-input.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../google-map/google-map.html">
<link rel="import" href="../google-map/google-map-search.html">
@igorcosta
igorcosta / grunt for ubuntu
Created April 2, 2015 19:10
When grunt breaks on Ubuntu 14.x
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
@igorcosta
igorcosta / fp_debugger.sh
Created September 3, 2015 18:21
Flash Player 11.2 Debugger for Firefox on Ubuntu
sudo apt-get install ia32-libs nspluginwrapper
sudo mkdir /usr/lib/flash-plugin/
wget http://fpdownload.macromedia.com/pub/flashplayer/updaters/11/flashplayer_11_plugin_debug.i386.tar.gz
tar xzvf flashplayer_11_plugin_debug.i386.tar.gz
sudo cp libflashplayer.so /usr/lib/flash-plugin/
sudo chmod 775 /usr/lib/flash-plugin/libflashplayer.so
cd /usr/lib/mozilla/plugins
rm -rf npwrapper.libflashplayer.so # Not sure if this part is necessary or not
sudo ln -s /usr/lib/flash-plugin/libflashplayer.so .
sudo chmod 777 libflashplayer.so