Skip to content

Instantly share code, notes, and snippets.

View m-vdb's full-sized avatar

Maxime Vdb m-vdb

  • Rasa
  • Berlin
View GitHub Profile
@m-vdb
m-vdb / strategy_ads_url_migration.log
Created February 23, 2017 22:13
strategy_ads_url_migration.log
Updating strategy 5899d86cbaeb406652862ec3, Facebook campaign 6069469346641
12 ads to process.
Updating strategy 56e694ee539cc0432800158b, Facebook campaign 6045272103641
5 ads to process.
Updating strategy 5728b3564a6e5d6b340d286c, Facebook campaign 6048874836441
9 ads to process.
Updating strategy 576a66207f70ff4157416453, Facebook campaign 6055105248841
11 ads to process.
Updating strategy 576a81194a6e5d68aa1a4987, Facebook campaign 6055071385441
18 ads to process.
@m-vdb
m-vdb / original.raven.js
Created August 17, 2016 23:36
Cloudflare minification error
/*! Raven.js 3.4.1 (380d7d0) | github.com/getsentry/raven-js */
!function(a){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=a();else if("function"==typeof define&&define.amd)define([],a);else{var b;b="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,b.Raven=a()}}(function(){return function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;d.length>g;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a,b,c,d){return JSON.stringify(a,e(b,d),c)}function e(a,b){var c=[],d=[];return null==b&&(b=function(a,b){return c[0]===b?"[Circular ~]":"[Circular ~."+d.slice(0,c.indexOf(b)).join(".")+"]"}),funct
@m-vdb
m-vdb / script.sql
Created October 26, 2015 21:03
Rename job:apply:success events to job:apply:tentative
BEGIN;
LOCK events;
UPDATE events SET type = 'job:apply:tentative' WHERE type = 'job:apply:success' and date >= '2015-09-01';
END;
@m-vdb
m-vdb / ip_blocks.json
Last active September 16, 2015 22:18
Hosting provider IP blocks
[
// Amazon
"23.20.0.0/14",
"27.0.0.0/22",
"43.250.192.0/24",
"43.250.193.0/24",
"46.51.128.0/18",
"46.51.192.0/20",
"46.51.216.0/21",
"46.51.224.0/19",
@m-vdb
m-vdb / cdir.html
Created September 16, 2015 22:03
Generate a regex from a list of ip blocks
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
</head>
<body>
<script type="text/javascript" src="http://underscorejs.org/underscore.js"></script>
<script>
window.ip_blocks = ['feel me'];
// cidr2regex 0.0.3
// 2009 xenowire
@m-vdb
m-vdb / jquery.counter.js
Last active August 29, 2015 13:57
A simple counter for an element containing a number.
/*
Usage:
<span class="counter">10</span>
$(".counter").countTo({
step: 5, // step, integer
start: 10,
stop: 20
length: 500 // total duration in ms
});
@m-vdb
m-vdb / underscore_mixins.js
Last active August 29, 2015 13:57
Undescore mixins : whereDeep
// inspired from _.matches
function deepMatch (attrs) {
return function (obj) {
var attrVal, objVal;
if (obj === attrs) return true; //avoid comparing an object to itself.
for (var key in attrs) {
attrVal = attrs[key];
objVal = obj[key];
if (_.isObject(attrVal) && _.isObject(objVal)) {
if (!deepMatch(attrVal)(objVal)) {
@m-vdb
m-vdb / french_dep_coords.py
Created January 29, 2014 10:34
Retrieve the french department coordinates using wikipedia and google geolocation API.
from collections import OrderedDict
from itertools import tee
import time
from xml.etree import ElementTree as ET
from pygeocoder import Geocoder
import requests
wiki_url = u"http://fr.wikipedia.org/wiki/Liste_des_pr%C3%A9fectures_de_France"
{"version":3,"file":"job_pipe/static/js/interface_app/build.min.js","sources":["job_pipe/static/js/interface_app/build.js"],"names":["e","t","n","r","s","o","u","a","require","i","Error","f","exports","call","length",1,"Pipe","ExporterCollection","PipeCollection","ScrapedItemCollection","spiders","Router","window","Interface","eventAggregator","_","extend","Backbone","Events","initialize","this","on","domChangeTitle","loadedDashboard","toastr","options","positionClass","exporterCollection","pipeCollection","scrapedItemCollection","spiderCollection","SpiderCollection","processorCollection","ProcessorCollection","validatorCollection","ValidatorCollection","reset","exportersJSON","pipeList","sortPipeList","fetch","router","history","start","pushState","bindAll","setDefaultsForPipe","default_exporter","where","name","prototype","defaults","exporters","exporter","title","document","info","message","ms","timeOut","success","dashboard","fadeOut","error","redirect","onHidden","back","$","evt","href","attr","protocol"
@m-vdb
m-vdb / mongo_dbref_migration.js
Last active April 8, 2022 19:41
A quick example to migrate DBRef's to ObjectId's directly in MongoDB shell.
/*
A quick example to migrate DBRef's to ObjectId's directly in MongoDB shell.
Suppose we have 2 collections:
- db.authors
- db.books, with books like {title: "My book", writer: DBRef("authors", ObjectId("anyID"))}
*/