Skip to content

Instantly share code, notes, and snippets.

View benjamine's full-sized avatar

Benjamín Eidelman benjamine

View GitHub Profile
@benjamine
benjamine / clarinettrainer_buttons.user.js
Last active December 29, 2015 12:09
UserScript/ClarinetTrainerButtons
// ==UserScript==
// @name Clariner Trainer Buttons
// @namespace clarinettrainer.buttons
// @version 0.2
// @description make clariner trainer show buttons for all notes
// @include http://www.clarinettrainer.com/*
// @copyright 2013+, Benjamin Eidelman
// ==/UserScript==
@benjamine
benjamine / github-tag
Last active August 1, 2017 17:37
move a git tag remotely using github API (avoiding any clone or fetch)
#!/bin/sh
#
# moves a tag in a github repo
#
# Usage: github-tag <tag-name> <ref> <apirepourl>
#
# Examples:
# github-tag env-staging heads/release https://[email protected]/repos/user/reponame
# github-tag env-production tags/env-staging https://[email protected]/repos/user/reponame
if [ $# -lt 3 ]
@benjamine
benjamine / winrb
Created January 12, 2014 05:34
simplistic WinRM CLI ruby script for Vagrant Windows guest machines ( https://github.com/WinRb/vagrant-windows )
#!/usr/bin/env ruby
# requires:
# gem instal -r winrm
# gem install active_support
command = ARGV.join(' ')
if not command
raise "no command specified, usage: winrm <windows command>"
end
@benjamine
benjamine / left.json
Last active July 27, 2023 20:33
Json Diff Example
{
"name": "South America",
"summary": "South America (Spanish: América del Sur, Sudamérica or Suramérica; Portuguese: América do Sul; Quechua and Aymara: Urin Awya Yala; Guarani: Ñembyamérika; Dutch: Zuid-Amerika; French: Amérique du Sud) is a continent situated in the Western Hemisphere, mostly in the Southern Hemisphere, with a relatively small portion in the Northern Hemisphere. The continent is also considered a subcontinent of the Americas.[2][3] It is bordered on the west by the Pacific Ocean and on the north and east by the Atlantic Ocean; North America and the Caribbean Sea lie to the northwest. It includes twelve countries: Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Suriname, Uruguay, and Venezuela. The South American nations that border the Caribbean Sea”including Colombia, Venezuela, Guyana, Suriname, as well as French Guiana, which is an overseas region of France”are also known as Caribbean South America. South America has an area of 17,840,000 square kilome
@benjamine
benjamine / thirteen.js
Created August 18, 2014 21:56
thirteen.js
function sort(s) { return s.split('').sort().join(''); }
sort("eleven plus two") === sort("twelve plus one");
@benjamine
benjamine / its-programmers-day.js
Created September 13, 2014 18:27
it's programmer's day
itsProgrammersDay=((j1=new Date()).setMonth(0, 0),Math.round((new Date()-j1)/8.64e7)===Math.pow(2, 8));
@benjamine
benjamine / README.md
Last active August 29, 2015 14:10
driver-agnostic page objects

this is a preview of a page object model that works independently of the browser driver. page and component object define a hierarchy, and each of this objects expose a .s property that has an absolute css selector to find the element (eg. using document.querySelector), the way that property is built is by space-concatenating the css selectors of it's ancestors.

  var page = this.page('checkout');
  // page.orderConfirmation.purchase.s === ['#main .order-confirmation', 'button.purchase-btn'].join(' ')
  browserDriver.click(page.orderReview.purchase.s);
@benjamine
benjamine / bootstrap-grid-bookmarklet.js
Created February 23, 2015 16:09
bootstrap grid bookmarklet
/*
<style type="text/css">
#grid {
display: none;
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
@benjamine
benjamine / screen-record.sh
Last active March 27, 2018 01:06
record screen (with webcam overlay)
#!/bin/sh
# brew install ffmpeg
ffmpeg -thread_queue_size 50 \
-f avfoundation -framerate 30 -i "1" \
-thread_queue_size 50 -f avfoundation -framerate 30 -video_size 640x480 -i "0" \
-c:v libx264 -crf 18 -preset ultrafast \
-filter_complex 'overlay=main_w-overlay_w-10:main_h-overlay_h-10' -r 30 screen-capture.mkv
@benjamine
benjamine / github-markdown-diff-richify.user.js
Last active September 23, 2016 02:56
Enhances Github Markdown Diffs
// ==UserScript==
// @name GithubMarkdownDiffRichify
// @namespace http://tampermonkey.net/
// @version 0.1
// @description enhances markdown diffs in github, makes links clickable and embeds images (only images in the repo)
// @author https://github.com/benjamine
// @match https://github.com/*/pull/*
// @match https://github.com/*/compare/*
// @match https://github.com/*/commit/*
// @grant none