Skip to content

Instantly share code, notes, and snippets.

View TSFoster's full-sized avatar

Toby Foster TSFoster

View GitHub Profile
@deviantony
deviantony / README.md
Last active September 4, 2024 02:41
Portainer HTTP API by example

DEPRECATION NOTICE

This gist is now deprecated in favor of our official documentation: https://documentation.portainer.io/api/api-examples/ which contains up to date examples!

THE FOLLOWING DOCUMENTATION IS DEPRECATED

Please refer to the link above to get access to our updated API documentation and examples.

#!/usr/bin/env python
import pynvim, os, re, sys, time
# Get a list of buffers that haven't been deleted. `nvim.buffers` includes
# buffers that have had `:bdelete` called on them and aren't in the buffer
# list, so we have to filter those out.
def get_listed_buffers(nvim):
return set(buf.number for buf in nvim.buffers \
if nvim.eval('buflisted(%d)' % buf.number))
@paulirish
paulirish / bling.js
Last active November 4, 2024 17:48
bling dot js
/* bling.js */
window.$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function (name, fn) {
this.addEventListener(name, fn);
};
NodeList.prototype.__proto__ = Array.prototype;
@bascht
bascht / pinget.rb
Last active September 24, 2024 14:42
Download all a RSS feed and wget all the links for your personal offline reading pleasure. :)
#!/usr/bin/env ruby
# - encoding: utf-8 -
#
# E.g. with: pinget.rb https://feeds.pinboard.in/rss/secret:YOURSECRET/u:YOURUSERNAME/toread/
require 'rss'
require 'open-uri'
require 'uri'
WGET = ['wget',
@staltz
staltz / introrx.md
Last active November 14, 2024 11:27
The introduction to Reactive Programming you've been missing
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active November 11, 2024 22:46
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@jswanner
jswanner / migrate.rake
Last active August 15, 2024 15:15
Rolls back migrations in current branch not present in specified branch.
desc 'rolls back migrations in current branch not present in other'
task :rollback_branch_migrations, [:other_branch] do |t, args|
load "#{Dir.pwd}/Rakefile"
branch_migrations = BranchMigrations.new(args.other_branch)
puts ['Rollback the following migrations', branch_migrations, 'y,n? ']
next if %w[no n NO N].include?(STDIN.gets.chomp)
Rake::Task['environment'].invoke
@dweldon
dweldon / Cakefile
Last active December 11, 2015 18:49
This is a Cakefile for automatically compiling jade templates to html files in an arbitrarily deep directory tree. It was intended for use with meteor, however you can use it with any framework by changing the start task and the DIR. NOTE: this requires that chokidar and jade be installed via npm. NOTE: this assumes that the only html files unde…
fs = require 'fs'
path = require 'path'
chokidar = require 'chokidar'
{spawn} = require 'child_process'
DIR = path.join __dirname, 'client'
isType = (file, type) ->
path.extname(file) is '.' + type