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 July 7, 2024 01:37
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 July 23, 2024 14:51
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 November 28, 2020 16:20
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 July 25, 2024 16:52
The introduction to Reactive Programming you've been missing
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active June 16, 2024 13:44
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 April 1, 2021 22:05
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