Skip to content

Instantly share code, notes, and snippets.

@mderazon
mderazon / get-dmarc-reports.js
Created November 22, 2017 14:59
Downloads all DMARC reports from Postmark in XML format
const req = require('superagent');
const writeFile = require('util').promisify(require('fs').writeFile);
const apiToken = process.env.API_TOKEN;
const baseUrl = 'https://dmarc.postmarkapp.com';
(async function() {
const reports = [];
// get a list of all reports by id and create time
@mderazon
mderazon / copy-clip.js
Created September 27, 2017 07:00
copy-to-clipboard-bookmarklet
var link = 'https://example.com';
var textArea = document.createElement('textarea');
textArea.style.position = 'fixed';
textArea.style.top = 0;
textArea.style.left = 0;
textArea.style.width = '2em';
textArea.style.height = '2em';
@mderazon
mderazon / .travis.yml
Last active April 13, 2020 11:05
Automatic deployment to Google Cloud Functions with Travis-ci
# Use Dockerized infrastructure
sudo: false
# Use node_js environnement
language: node_js
node_js:
- "6"
# Cache Gcloud SDK between commands
cache:
@mderazon
mderazon / url-check.md
Last active May 30, 2020 14:30 — forked from oscarb/README.md
Formula to check if website in cell A1 in a Google Spreadsheet is up, using the W3C HTML Checker API

Validate URL in a Google Spreadsheet

Formula to check if URL in cell A1 in a Google Spreadsheet is up, using the W3C HTML Checker API

Formula

=IF(A1<>"",IF(ISERROR(FIND("non-document-error", INDEX(IMPORTDATA("https://validator.w3.org/nu/?out=json&doc=" & A1),0,2))),"✓","✗"),"")

Output

@mderazon
mderazon / convert-media.sh
Created November 1, 2016 09:37
convert images and videos screenshots to something that's nice to paste in github
if [[ "$1" == *.mp4 ]]
then
/Users/me/bin/togif "$1"
fi
if [[ "$1" == *.png ]]
then
/Users/me/bin/topic "$1"
fi
@mderazon
mderazon / youtube-to-mp3.sh
Created May 25, 2016 11:35
get a bunch of youtube videos as mp3
youtube-dl -f 140 --ffmpeg-location /usr/local/bin/ffmpeg [list of youtube urls]
for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 128k "${f%.m4a}.mp3"; done
var express = require('express')
var multer = require('multer')
var storage = multer.memoryStorage()
var upload = multer({ storage: storage })
var app = express()
app.post('/upload', upload.single('users.csv'), function (req, res, next) {
if (!req.file) {
import React from 'react'
import classNames from 'classnames'
import request from 'superagent'
export default class FileUploader extends React.Component {
constructor (props) {
super(props)
this.state = {
fileName: '',
@mderazon
mderazon / config.sh
Last active August 29, 2015 14:23
automatically create a tag for package version bump
# file: .git/config
# this pushes every branch that's already there, plus tags. It does not force push, and it does not push branch that we didn't push manually.
[remote "origin"] # or whatever it is named
url = ...
push = :
push = +refs/tags/*:refs/tags/*
@mderazon
mderazon / node_modules.sh
Last active August 29, 2015 14:17
fav node modules
npm install -g trash mocha gulp nodemon iojs-dep-check