Skip to content

Instantly share code, notes, and snippets.

View michaelmrose's full-sized avatar
💭
Available to hire

Michael Rose michaelmrose

💭
Available to hire
View GitHub Profile
@michaelmrose
michaelmrose / example.fish
Created June 28, 2015 23:49
default variables and variable parsing in fish
set somevariable default val
set someothervariable default val
for i in (getvariables $argv)
set val (explode $i)
set $val[1] $val[2]
end
function getvariables
if not substr "$argv" =
@michaelmrose
michaelmrose / keyhandler and fishstdin
Created July 12, 2015 06:12
Enable Custom Actions in SXIV
#!/bin/sh
# Example for $XDG_CONFIG_HOME/sxiv/exec/key-handler
# Called by sxiv(1) after the external prefix key (C-x by default) is pressed.
# The next key combo is passed as its first argument. The paths of all marked
# images--or of the current image, if no image is marked--are passed via stdin,
# one file path per line.
# sxiv(1) blocks until this script terminates. It then checks which images
# have been modified and reloads them.
@michaelmrose
michaelmrose / mpv-0.9.2.ebuild
Created July 17, 2015 19:25
Working ebuild for latest mpv as of 7-16-15
# Distributed under the terms of the GNU General Public License v2
EAPI=5
EGIT_REPO_URI="https://github.com/mpv-player/mpv.git"
PYTHON_COMPAT=( python{2_7,3_3,3_4} )
PYTHON_REQ_USE='threads(+)'
inherit eutils python-any-r1 waf-utils pax-utils fdo-mime gnome2-utils
[[ ${PV} == *9999* ]] && inherit git-r3
@michaelmrose
michaelmrose / colors.conf
Created September 12, 2015 01:42
colors.conf for hexchat
color_0 = ffff ffff ffff
color_1 = 4e4e 4e4e 4e4e
color_2 = a8a8 ffff 6060
color_3 = ffff 7373 fdfd
color_4 = 9696 cbcb fefe
color_5 = 7777 5454 3e3e
color_6 = 94bc 5925 ffff
color_7 = eaea 9595 1f1f
color_8 = ffff ffff b6b6
color_9 = a6a6 e2e2 2e2e
@-moz-document domain("www.freecodecamp.com") {
body {background: #0c0c0c;}
.navbar {background: #111;}
.navbar-right{background: #111;}
.panel-heading{
background: #111 !important;
border-color:#111 !important;
}
.panel-info{border-color:#111;}
.panel-body{background-color:#222}
function romanMain() {
this.version = '0.81';
w = 420;
h = 60;
var s = "";
s += '<div style="position:relative; width:' + w + 'px; height:' + h + 'px; background-color: #def; border: 2px solid #ddeeff; border-radius: 10px; margin:auto; display:block;">';
s += '<div style="margin-top: 10px; font: 16px arial; font-weight: bold; color: black; text-align:center;">';
s += '<input id="val" size="26" style="font-size: 20px; line-height: 26px; text-align:center;" />';
s += '<input type="submit" value="Convert" style="font-size: 18px; line-height: 24px" onclick ="get()" />';
s += '</div>';
@michaelmrose
michaelmrose / romanity.js
Last active January 17, 2016 08:41
oh the romanity
function convert(num) {
var remainder = num;
var result = "";
while(remainder > 0){
var number = closestNumeralWithoutGoingOver(remainder);
result = result.concat(returnNumeral(number));
remainder -= number;
}
return result;
}
@michaelmrose
michaelmrose / recursiveRomanity.js
Created January 18, 2016 15:47
recursive solution to roman numeral generator
var numerals = [1,4,5,9,10,40,50,90,100,400,500,900,1000];
var ohtheromanity = {1: "I", 4: "IV", 5:"V", 9: "IX", 10: "X", 40: "XL", 50: "L",
90: "XC", 100: "C", 400: "CD", 500: "D", 900: "CM", 1000: "M"};
function convert(n) {
if (n === 0){return "";}
else {
var largestInclusiveNumber = numerals.sort(function(x,y){return x-y;}).filter(function(x){return x<=n;}).pop();
var remainder = n -= largestInclusiveNumber;
return ohtheromanity[largestInclusiveNumber].concat(convert(remainder));
}
@michaelmrose
michaelmrose / Example.md
Created January 27, 2016 23:36
-e Example.md

A Colored Clojure Repl Via Neovim, Fish, and Lein

We'll start with the assumption that your cwd in vim is set to the directory of a clojure file perhaps via autochdir.

Now with some vimscript we'll start a terminal buffer, set the proper syntax coloring, turn on rainbow parens and only then run lein repl. Note it doesn't work if these aren't done before lein repl.

function! NvimRepl()
 terminal
@michaelmrose
michaelmrose / somefish.md
Last active January 27, 2016 23:51
some fish functions
    function in-terminal-or-out
      if in-terminal
        eval $argv
      else
        lilyterm -e ff $argv
      end
 end