Skip to content

Instantly share code, notes, and snippets.

@abarre
abarre / instruction.md
Last active June 13, 2018 14:02
URL Shortener Full stack

URL Minifier

Choose your favorite web technology to develop an URL shortener.

Backend

The backend should be able to perform the following actions :

  • Submit an URL to be shortened and store them in a persistent storage
  • GET on shortened URLS will redirect to the original URL (301 redirection)
  • Get shortened URLs list (this should be protected by a basic auth)
  • Get stats (number of visits) for a shortened URL
@abarre
abarre / FasterizeLogToApacheFormat.md
Created August 16, 2017 14:23
Transform Raw JSON Fasterize log to Apache Combined Log Format

Transform Raw JSON Fasterize log to Apache Combined Log Format

This script use node and the package moment.js. This is useful for Screaming Frog.

Installation

npm install moment

Usage

#!/bin/bash
# This script requires ImageMagick and Ghostscript
mkdir -p comparison
cd comparison
rm *
http --download "$1"
for plugin in cleanupAttrs removeDoctype removeXMLProcInst removeComments removeMetadata removeTitle removeDesc removeUselessDefs removeEditorsNSData removeEmptyAttrs removeHiddenElems removeEmptyText removeEmptyContainers removeViewBox cleanUpEnableBackground minifyStyles convertStyleToAttrs convertColors convertPathData convertTransform removeUnknownsAndDefaults removeNonInheritableGroupAttrs removeUselessStrokeAndFill removeUnusedNS cleanupIDs cleanupNumericValues cleanupListOfValues moveElemsAttrsToGroup moveGroupAttrsToElems collapseGroups removeRasterImages mergePaths convertShapeToPath sortAttrs transformsWithOnePath removeDimensions removeAttrs addClassesToSVGElement removeStyleElement
do
svgo --disable=$plugin ok.svg ok.min-$plugin.svg
done
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#!/usr/bin/env node
/**
* Copyright (c) 2015 Trent Mick. All rights reserved.
* Copyright (c) 2015 Joyent Inc. All rights reserved.
*
* bunyan -- filter and pretty-print Bunyan log files (line-delimited JSON)
*
* See <https://github.com/trentm/node-bunyan>.
*
* -*- mode: js -*-
@abarre
abarre / actuellement
Last active August 29, 2015 14:15
le nom de domaine www.emilie-wilhelm.com ne résout pas.
-> % dig www.emilie-wilhelm.com
; <<>> DiG 9.8.3-P1 <<>> www.emilie-wilhelm.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 31886
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
;; QUESTION SECTION:
;www.emilie-wilhelm.com. IN A
@abarre
abarre / gist:2f53b860ac205ac87802
Created June 6, 2014 09:40
IPAD scroll stop javascript
<!doctype html>
<html>
<head>
<title>lazyload - 03/30/2012</title>
<link rel=stylesheet href=./demo.css type=text/css />
<script>/*! lazyload v0.8.3 fasterize.com | github.com/fasterize/lazyload#licence */
/*
lazyload.js: Image lazy loading
[WebPagetest]
url=http://wpt.custom.com/
location=agent_paris
browser=chrome,Firefox,IE_10,Safari
Time Limit=120
key=#KEY#
;Automatically install and update support software (Flash, Silverlight, etc)
software=http://www.webpagetest.org/installers/software.dat
[chrome]
-> % cap cache01-devfe chef
Creating topology cache directory /var/folders/v9/v9nD7A0PFbW3ir2Qf5ZYKk+++TQ/-Tmp-/topology_provider_cache20140225-9752-44iewd
Reusing topology cache directory /var/folders/v9/v9nD7A0PFbW3ir2Qf5ZYKk+++TQ/-Tmp-/topology_provider_cache20140225-9752-44iewd
triggering load callbacks
* 18:59:13 == Currently executing `topology:load_topology'
* Using zookeeper servers : 192.168.56.11:2181
* 18:59:14 == Currently executing `cache01-devfe'
* 18:59:14 == Currently executing `chef'
* 18:59:14 == Currently executing `chef:chef'
* executing "sudo sh -c 'mkdir -p /etc/chef'"