Skip to content

Instantly share code, notes, and snippets.

@bensquire
bensquire / convert.sh
Last active May 10, 2020 08:02
Convert directory of MP4's to MKV's using ffmpeg (tested on OSX)
#!/bin/sh
for i in *.mp4; do
ffmpeg -i "${i}" -c:v copy -c:a copy "${i}.mkv"
done
@bensquire
bensquire / countries.json
Created October 20, 2016 11:03
JSON Country List based on the ISO-3366-1 Alpha-3 Codes, with eu countries marked
[
{
"code": "AFG",
"name": "Afghanistan",
"eu": false
},
{
"code": "ALA",
"name": "Åland Islands",
"eu": false
@bensquire
bensquire / pagination.html.twig
Created January 27, 2017 11:10 — forked from omerucel/pagination.html.twig
A gist for pagination in Twig, based on the total number of pages, the current page and some URL-settings.
{#
Source: http://dev.dbl-a.com/symfony-2-0/symfony2-and-twig-pagination/
Updated by: Simon Schick <[email protected]>
Parameters:
* currentFilters (array) : associative array that contains the current route-arguments
* currentPage (int) : the current page you are in
* paginationPath (string) : the route name to use for links
* showAlwaysFirstAndLast (bool) : Always show first and last link (just disabled)
* lastPage (int) : represents the total number of existing pages
@bensquire
bensquire / trello-card-attachment.js
Last active April 28, 2022 12:14
Trello API Card Attachment using formdata-node and node-fetch (NodeJS)
import fetch from "node-fetch"
import {FormData} from "formdata-node"
import {fileFromPath} from "formdata-node/file-from-path"
const file = './354.jpg'
const cardId = 'REPLACE'
const key = 'REPLACE'
const token = 'REPLACE'
const form = new FormData()
@bensquire
bensquire / trello-card-attachment.js
Last active April 28, 2022 12:14
Trello API Card Attachment using formdata-node and axios (NodeJS)
// Note, axios isn't a formData spec compliant client, hence the need for formdata-node encoder
import {Readable} from "stream"
import axios from 'axios';
import {FormData} from "formdata-node"
import {fileFromPath} from "formdata-node/file-from-path"
import {FormDataEncoder} from "form-data-encoder"
const cardId = 'REPLACE'
const file = './354.jpg'