Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bgmort
bgmort / watermark.bash
Created September 16, 2021 23:35
Bash script for watermarking with imagemagick
#!/bin/bash
## This script uses the `convert` command from the imagemagick library to add a watermark to one or more images
WATERMARK= # add your default watermark here
WSIZE="20%"
WPADDING="0"
GRAVITY=SouthEast
OUTDIR=watermarked
DRYRUN=
VERBOSE=
@bgmort
bgmort / parseSignedRequest.js
Last active June 2, 2020 03:09 — forked from cyakimov/gist:1139981
Decode Facebook signed_request with NodeJS
// Fixed an error with character replacement, removed a dependency, included imports, throw errors, and fixed global variables
var crypto = require('crypto');
//remove a dependency on b64url
function atob(str) {
return new Buffer(str, 'base64').toString('binary');
}
//this is not used here, but to leave it out would be like passing the salt without the pepper.
function btoa(str) {
@bgmort
bgmort / embed.html
Last active August 6, 2016 16:42
Simple way to send a whole bunch of texts one at a time from MightyText
Drag this link to your bookmark bar to save as a bookmarklet:
<a href="javascript:var s=document.createElement('script');s.type='text/javascript';document.body.appendChild(s);s.src='https://rawgit.com/bgmort/0fcf5971fe80e2c8ac13737caf9aa9b2/raw/mightytext-masstext.js'; void 0">Mighty Mass Text</a>
@bgmort
bgmort / run_multiple_commands.py
Last active November 18, 2017 12:47
Cleaned up version of code posted at https://forum.sublimetext.com/t/run-multiple-commands-command/6848/35. Added support for repeated commands and example key mappings to move/scroll by ten lines.
# run_multiple_commands.py
import sublime, sublime_plugin
# Takes an array of commands (same as those you'd provide to a key binding) with
# an optional context (defaults to view commands) & runs each command in order.
# Valid contexts are 'text', 'window', and 'app' for running a TextCommand,
# WindowCommands, or ApplicationCommand respectively.
class RunMultipleCommandsCommand(sublime_plugin.TextCommand):
def exec_command(self, command):
if not 'command' in command:
raise Exception('No command name provided.')
<script type="text/javascript">
(function($){
var matches = location.pathname.match(/browse\/([A-Z]+-[0-9]+)/);
if (matches) {
$(document).ready(function() {
/*
* Add diffs to change logs
*/
var script = document.createElement('script');
/**
* converts like objects into a format which will serialize to a more compact JSON string
*/
function listToTable (list, cols){
var table = {};
for (var i = 0, item; item= list[i], i < list.length; i++){
for (var key in item){
if (item.hasOwnProperty(key)){
if (!table[key]) table[key] = [];
table[key][i] = item[key]
@bgmort
bgmort / jira.bulk-edit-subtasks.html
Last active December 11, 2015 05:29
Script providing the functionality discussed at https://jira.atlassian.com/browse/JRA-13079. This script may be added to the page by pasting it into your announcement banner. Provides a link from a JIRA issue page to modify all of the issue's subtasks in bulk. Tested only on JIRA v5.2.1. Thanks to Valentijn Scholten for finding out how to add th…
<script type="text/javascript">
/*
* add an 'edit all' option to issue pages
*/
(function(){
if (location.pathname == '/issues/' && location.hash == '#editall') {
location.href = '/secure/views/bulkedit/BulkEdit1!default.jspa?reset=true'
}
else {
var matches = location.pathname.match(/browse\/([A-Z]+-[0-9]+)/);
@bgmort
bgmort / jquery.trimleft.js
Last active December 10, 2015 20:38
Simple jquery function to trim a line of text with ellipses on left side, like text-overflow: ellipsis clip will in Firefox only. Changes the text permanently, so the amount of text hidden will not change when the window is resized. For this to work, the element you pass in needs to have overflow: hidden and white-space: nowrap; http://stackover…
/**
* Simple jquery function to trim a line of text with ellipses on left side,
* like text-overflow: ellipsis clip will in Firefox only. Changes the text
* permanently, so the amount of text hidden will not change when the window
* is resized.
* For this to work, the element you pass in needs to have overflow: hidden
* and white-space: nowrap;
*
* http://stackoverflow.com/questions/9793473/text-overflow-ellipsis-on-left-side
*/
@bgmort
bgmort / gist:4455742
Created January 4, 2013 20:28
User script providing the functionality discussed at https://jira.atlassian.com/browse/JRA-13079. Provides a link from a JIRA issue page to a search page containing the issue's subtasks, where then can be modified in bulk.
// ==UserScript==
// @name Jira: Edit all sub-tasks
// @description Open subtasks of a story in search so they may all be modified at once
// @match http://jira.your.company.com/browse/*
// ==/UserScript==
(function(){
var matches = location.pathname.match(/[A-Z]+-[0-9]+/),
list, id, item, link;
@bgmort
bgmort / starwars-ify.bookmarklet.js
Last active July 29, 2016 19:18
Star Wars-ify Bookmarklet
//Intended for use as a bookmarklet. See http://mortensoncreative.com/code/starwars-ify
//License TBA
(function(c){var a=c.body.style;c.documentElement.style.background=a.background="black";a.color="yellow";a.height=a.width="100%";a.position="fixed";a.overflowY="scroll";a.top="-15%";a.webkitTransform=a.MozTransform=a.transform="matrix3d(1,0,0,0,0,1,0,-0.0015,0,0,1,0,0,0,0,1)";for(var a=c.body.children,b=0;b<a.length;b++)"SCRIPT"!=a[b].nodeName&&(a[b].style.overflowY="scroll",a[b].style.maxHeight="100%");var b=new Audio();b.src="https://archive.org/download/StarWarsThemeSongByJohnWilliams/Star%20Wars%20Theme%20Song%20By%20John%20Williams.mp3";var f=function(){for(var a,b=0;a=c.body.children[b];b++)"SCRIPT"!=a.nodeName&&(a.scrollTop+=2);setTimeout(f,50)};setTimeout(f,1000);b.load();b.play()})(document)