Skip to content

Instantly share code, notes, and snippets.

View alon85's full-sized avatar

Alon Motro alon85

View GitHub Profile
@alon85
alon85 / minimogrify.vcl
Last active July 14, 2020 20:37
VCL code to translate minimogrify url to fastly url
sub vcl_recv {
declare local var.x INTEGER;
declare local var.y INTEGER;
declare local var.crop STRING;
declare local var.resize STRING;
declare local var.fastlyImage STRING;
set var.crop = "";
set var.resize = "";
if (req.url.path ~ "(?i)local/-/((media|presto)/.+\.jpg)") {
@alon85
alon85 / minimogrify-to-fastly-url.js
Created March 4, 2020 14:40
Translate Minimogrify URLs to Fastly URLs
'use strict';
const _ = require('lodash');
const imageBaseName = 'http://www.gannett-cdn.com';
let fastlyImage;
let fastlyImageActions = [];
let cropString;
let resizeString;
const imageString = decodeURIComponent(process.argv[2]);
'use strict';
let validators;
module.exports = validators = {
isValidHeadline: function(payload) {
if (!payload.subject && _.isEmpty(payload.attributes)) {
return false;
} else if (!_.isEmpty(payload.attributes) && !payload.attributes.headline) {
return false;
'use strict';
const request = require('request');
let utils;
module.exports = utils = {
createRequestParameters: function(method, url, contentType, body, options) {
if (!method || !url) {
throw new Error('method and url is required');

Keybase proof

I hereby claim:

  • I am alon85 on github.
  • I am alon85 (https://keybase.io/alon85) on keybase.
  • I have a public key ASAl8emQPq3DfWJ8bVcIXbWac5I5Wp_SpMPryfTntI5oyQo

To claim this, I am signing this object:

{
"swagger": "2.0",
"info": {
"version": "1.0.0",
"title": "Oembed-API",
"contact": {
"name": "CPS Team"
}
},
"basePath": "/oembed",
[
{
"assetId": 20565801,
"statusName": "published",
"assetTypeName": "text",
"priorityAssetTypeName": "video",
"photo": {
"crops": {
"16_9": "http://www.gannett-cdn.com/-mm-/b4d390e9b6a091cf5638ceaca57104c015818af3/c=0-232-4479-2763/local/-/media/2014/12/17/Phoenix/Phoenix/635544462987720329-rally2.jpg",
"9_16": "http://www.gannett-cdn.com/-mm-/b1a0a0fd0838b865b6698e233cf16b29c77e2018/c=1401-0-3078-2995/local/-/media/2014/12/17/Phoenix/Phoenix/635544462987720329-rally2.jpg",
using System;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace ResizeImage
{
from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework import status
#from mobilefeeds.models.CombinedFeed import CombinedFeed
from mobilefeeds.models.FrontFeed import FrontFeed
from mobilefeeds.models.BreakingNewsFeed import BreakingNewsFeed
from mobilefeeds.models.AssetFeed import AssetFeed
from mobilefeeds.models.GalleryFeed import GalleryFeed
from mobilefeeds.models.TagFeed import TagFeed
TEST_SITE=http://ugc-dev.gannettdigital.com/v1/collections
+ /opt/python-2.7.3/bin/python2.7 /.jenkins/python-scripts/poll_site.py http://ugc-dev.gannettdigital.com/v1/collections
poll_site: attempt[0] = 502
poll_site: attempt[1] = 502
poll_site: attempt[2] = 502
poll_site: attempt[3] = 502
poll_site: attempt[4] = 502
poll_site: attempt[5] = 502
poll_site: attempt[6] = 502
poll_site: attempt[7] = 502