Skip to content

Instantly share code, notes, and snippets.

@superbob
superbob / ddns_provider.conf
Last active January 27, 2024 00:57
Namecheap Synology DSM DDNS provider
#Insert this at the end of /etc.defaults/ddns_provider.conf
[Namecheap]
modulepath=/usr/syno/bin/ddns/namecheap.php
queryurl=https://dynamicdns.park-your-domain.com/update
@meleu
meleu / md-toc.sh
Last active February 16, 2022 18:36
bash script to create a Table of Contents from a Markdown file
#!/bin/bash
# md-toc.sh
############
# Generates a Table of Contents getting a markdown file as input.
#
# Inspiration for this script:
# https://medium.com/@acrodriguez/one-liner-to-generate-a-markdown-toc-f5292112fd14
#
# The list of invalid chars is probably incomplete, but is good enough for my
# current needs.
@JohnSundell
JohnSundell / gh
Created April 30, 2018 07:51
Script that makes it easy to show a Git repo on GitHub.com
#!/usr/bin/env bash
# If run without a name, open any current repo
if [ -z "$1" ]; then
URL=$(git remote get-url origin)
URL=${URL/"git@github.com:"/"https://github.com/"}
URL=${URL/".git"/""}
open $URL
else
open "https://github.com/$1"
@loilo
loilo / bem.md
Last active March 7, 2024 09:14
Sass mixins for BEM

ATTENTION!

I keep this Gist for archival reasons, however I strongly recommend against using it. As I discovered after several weeks in production usage, these BEM mixins cause unexpected, unfixable and hard-to-debug selectors in some cases (especially when nested in some ways).

Sass mixins for BEM

This is a utility with three simple Sass mixins for writing BEM as DRY as possible, heavily inspired by Hugo Giraudel's article on CSS Tricks.

It exposes three Sass mixins: block, element and modifier.

@johnfmorton
johnfmorton / TransmitOpenTerminal.txt
Last active May 30, 2023 14:42
Use Transmit 5 to open in iTerm (instead of Terminal.app) as mentioned here https://library.panic.com/transmit5/open-in-terminal/
on openTerminal(location, remoteHost, serverPort)
tell application "System Events"
-- some versions might identify as "iTerm2" instead of "iTerm"
set isRunning to (exists (processes where name is "iTerm")) or (exists (processes where name is "iTerm2"))
end tell
tell application "iTerm"
activate
set targetTab to ""
@johnfmorton
johnfmorton / jekyll-collections-prev-next-wrap-around.html
Last active May 16, 2019 15:46 — forked from budparr/jekyll-collections-prev-next.html
Previous Next Links for Jekyll Collections - with wrap around to beginning link and last link when needed
{% capture the_collection %}{{page.collection}}{% endcapture %}
{% if page.collection %}
{% assign document = site[the_collection] %}
{% endif %}
<h1>TITLE: {{ page.title }}</h1>
{% for links in document %}
{% if forloop.first %}
{% assign first = links %}
{% endif %}
{% if forloop.last %}
@johnfmorton
johnfmorton / _mixins.scss
Last active July 29, 2017 09:58
These are SASS mixins I reuse. Helpful to me. Helpful to you? Take 'em!
// -- I didn't make this but it's really handy! - John
/// Convert angle
/// @author Chris Eppstein
/// @param {Number} $value - Value to convert
/// @param {String} $unit - Unit to convert to
/// @return {Number} Converted angle
@function convert-angle($value, $unit) {
$convertable-units: deg grad turn rad;
$conversion-factors: 1 (10grad/9deg) (1turn/360deg) (3.1415926rad/180deg);
#!/bin/sh
# requires jpeg-recompress <https://github.com/danielgtaylor/jpeg-archive>
# same as jpeg-archive, but:
# * without 3rd-party dependencies
# * can re-compress a single file as well as a directory
# * replaces original with optimized version (keeping file timestamps)
# * no support for RAW images
@midwire
midwire / ffmpeg-install.sh
Last active September 4, 2018 08:00 — forked from clayton/ffmpeg-install.sh
Install FFMPEG on OS X with HomeBrew and all libs and support
brew install ffmpeg \
--with-dcadec \
--with-faac \
--with-fdk-aac \
--with-ffplay \
--with-fontconfig \
--with-freetype \
--with-frei0r \
--with-libass \
--with-libbluray \
@pwenzel
pwenzel / ffmpeg-mkv-to-mp4.sh
Last active September 10, 2023 16:22
MKV and AVI to MP4 Conversion for Apple TV
# See also https://trac.ffmpeg.org/wiki/Encode/AAC
# direct copy
ffmpeg -i input.mkv -c:v copy -c:a copy output.mp4
# direct copy video, but convert audio to AAC with default variable bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental output.mp4
# direct copy video, but convert audio to AAC with constant bit rate
ffmpeg -i input.mkv -c:v copy -c:a aac -strict experimental -b:a 320k output.mp4