Skip to content

Instantly share code, notes, and snippets.

Michael DeRazon mderazon

View GitHub Profile
@mderazon
mderazon / get-dmarc-reports.js
Created Nov 22, 2017
Downloads all DMARC reports from Postmark in XML format
View get-dmarc-reports.js
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 Sep 27, 2017
copy-to-clipboard-bookmarklet
View copy-clip.js
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 Apr 13, 2020
Automatic deployment to Google Cloud Functions with Travis-ci
View .travis.yml
# 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 — 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
View url-check.md

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 Nov 1, 2016
convert images and videos screenshots to something that's nice to paste in github
View convert-media.sh
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
get a bunch of youtube videos as mp3
View youtube-to-mp3.sh
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
View upload-file-server.js
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) {
View upload-file-client.jsx
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 Aug 29, 2015
automatically create a tag for package version bump
View config.sh
# 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 Aug 29, 2015
fav node modules
View node_modules.sh
npm install -g trash mocha gulp nodemon iojs-dep-check
You can’t perform that action at this time.