Skip to content

Instantly share code, notes, and snippets.

View arnaudlimbourg's full-sized avatar

Arnaud Limbourg arnaudlimbourg

View GitHub Profile
@arnaudlimbourg
arnaudlimbourg / cleanup_image_files.sh
Created April 16, 2021 15:36
Delete images files which names cannot be found in the code base
IMAGES_LOCATION="./"
FILES=`find $IMAGES_LOCATION -not -name '*.scss'`
# loop through the file list, exclude the extension to be very safe
# and remove the files that have no match. This approach is conservative
# since we might keep files that are no used due to a different extension
# but it should not happen a lot
for FILE in $FILES; do
FULLNAME=$(basename "$FILE")
ffmpeg -i in.mov -ab 96k -vcodec libx264 -preset slower -level 21 -refs 2 -b:v 1000K -threads 0 out.mp4
@arnaudlimbourg
arnaudlimbourg / compress-pdf-with-gs.md
Created November 17, 2015 14:31 — forked from guifromrio/compress-pdf-with-gs.md
Compress PDF files with ghostscript

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.
{
"vars": {
"@gray-base": "#000",
"@gray-darker": "lighten(@gray-base, 13.5%)",
"@gray-dark": "lighten(@gray-base, 20%)",
"@gray": "lighten(@gray-base, 33.5%)",
"@gray-light": "lighten(@gray-base, 46.7%)",
"@gray-lighter": "lighten(@gray-base, 93.5%)",
"@brand-primary": "#ed4a4a",
"@brand-success": "#5cb85c",
@arnaudlimbourg
arnaudlimbourg / video_to_gif
Created May 21, 2015 10:00
Convert video to animated gif with ffmpeg and gifsicle
# found on the net, here to remember the exact command
brew install gifsicle
ffmpeg -i input_file -vf "scale=min(iw\,600):-1" -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=7 --colors 256 > outfile.gif
<link rel="import" href="../chart-js/chart-js.html">
<link rel="import" href="../core-menu/core-submenu.html">
<link rel="import" href="../core-item/core-item.html">
<link rel="import" href="../core-pages/core-pages.html">
<polymer-element name="my-element">
<template>
<style>
:host {
@arnaudlimbourg
arnaudlimbourg / pre-commit.sh
Last active October 13, 2015 22:38
Pre commit hook for python projects
#!/bin/sh
CHANGED=`git diff --cached --name-only --diff-filter=ACM | grep ".py"`
if [ -z "$CHANGED" ]; then
exit 0
fi
# run tests
# TESTS=`py.test ferpection`
# if [ $TESTS -ne 0 ]; then
# echo "your tests failed"
@arnaudlimbourg
arnaudlimbourg / vim7.3_mac_install.rb
Created May 30, 2012 19:35 — forked from chriskau/vim7.3_mac_install.rb
Script to install Vim 7.3 with ruby support for Mac OS X Lion
# requires root permissions in /usr/bin/
star = String.new
8.times { star += "*" }
Star = "\n#{star * 3}\n"
def newblock string
puts "\n#{Star}#{string}#{Star}\n"
end