Skip to content

Instantly share code, notes, and snippets.

View benjamine's full-sized avatar

Benjamín Eidelman benjamine

View GitHub Profile
@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 / 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 / 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://usertoken@api.github.com/repos/user/reponame
# github-tag env-production tags/env-staging https://usertoken@api.github.com/repos/user/reponame
if [ $# -lt 3 ]
@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 / alias.cmd
Last active February 19, 2024 15:49
Aliases for windows command line
::
:: Aliases for windows command line
::
:: Installation:
::
:: - create a folder for your aliases (eg: ```c:\cmd-aliases```)
:: - add that folder to your PATH variable
:: - save this script as setalias.cmd on that folder
:: - run "alias" to see usage
::
@benjamine
benjamine / timelinks.js
Last active December 19, 2015 15:59
Turn any text that looks like time to a time link alla youtube. clicking will change url hash, and (if found) a jwplayer to seek to that position
@benjamine
benjamine / README.md
Last active December 9, 2021 22:46
Delete your fork master branch, useful when using feature branches

When working with feature branches, the master branch on your fork becomes useless (you probably base your branches on upstream/master). As a result you fork's master gets outdated, and can lead to mistakes.

Deleting it is a good idea, but github needs a "default branch" to show on website, this script will create an orphan "_default" branch with just an explanatory README.md on it, and set that as default for github (you'll be asked your github password).

DISCLAIMER: This script will delete your master branch locally and remotely, be sure you don't need it anymore before running this!

@benjamine
benjamine / gihub-fullwidth.user.js
Last active December 15, 2015 07:19
UserScript/GithubFullWidth
// ==UserScript==
// @name Github Full Width
// @namespace github.responsive.width
// @version 0.1
// @description make github use all your screen
// @include https://github.com/*/blob/*
// @include https://github.com/*/pull/*/files
// @include https://github.com/*/commit/*
// @copyright 2013+, Benjamin Eidelman
// ==/UserScript==
@benjamine
benjamine / suppressnavkeys.js
Created August 4, 2011 13:24
Disable navigation keys for web apps (F5, Backspace)
(function(log) {
var handler = function(evt) {
evt = evt || window.event;
var target = evt.target || evt.srcElement;
// F5, backspace
if ((evt.keyCode == 116) ||
(evt.keyCode == 8 && !/input|textarea/i.test(target.nodeName))
) {
@benjamine
benjamine / postMessage.js
Created June 7, 2011 15:04
window.postMessage
this.testData = {
message: 'a random message '+Math.floor(Math.random()*10000),
log: []
};
// test that postMessage is supported
ok(typeof window.postMessage == 'function', 'window.postMessage is supported');
// test posting a message to the same frame