Skip to content

Instantly share code, notes, and snippets.

@byrney
byrney / simpleclip
Last active March 25, 2021 03:05
Bookmarklet for IOS that uses heckyeahmarkdown to convert current page to MD and then create as a note in IOS simplenote app
javascript:(function(){var request=new XMLHttpRequest();var p=document.createElement("p");p.innerHTML="<strong>Clip to Simplenote</strong>";p.style.padding="20px";p.style.background="#fa0";p.style.left="20px";p.style.top=0;p.style.position="fixed";p.style.zIndex="9999999";p.style.opacity=".85";var st=document.createElement("p");p.appendChild(st);st.innerHTML="Converting...";document.body.appendChild(p);var url="http://heckyesmarkdown.com/go/?read=1&preview=0&showframe=0&output=json&u="+encodeURIComponent(location.href);request.onreadystatechange=function(){if(request.readyState==4&&request.status==200){st.innerHTML="<strong>Clipping</strong>";var res=JSON.parse(request.responseText);var note=res.title+"\n\n"+res.content+"\n\n"+res.url;st.innerHTML="<strong>Opening Simplenote</strong>";location.href="simplenote://new?content="+encodeURIComponent(note)+"&tag=webclip";p.hidden=true;}};request.open("GET",url,true);request.send();})();
@byrney
byrney / gist:10a48dfb9de1cf894608
Created November 9, 2014 22:56
MSBUild Batching Up Items
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
<PropertyGroup>
<DirRoot>$([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)'))</DirRoot>
</PropertyGroup>
<ItemGroup>
<TextFiles Include="$(DirRoot)/src/**/*.txt" Condition="'$(Solution)' == ''" />
<TextFiles Include="$(Solution)" />
source "https://supermarket.chef.io"
#metadata
cookbook 'windows'
cookbook 'chocolatey'
cookbook 'winbase', path: './winbase'
function usage(){
echo "usage"
}
function main(){
param(
[alias("s")][string] $serverName ,
[alias("v")][switch] $verbose
)
if(!$serverName){
@byrney
byrney / omnitruck-no-lang.md
Last active February 27, 2016 16:11
Omnitruck chef installer fails with 404 when LANG variable is not set

vagrant tells the guest to run

https://omnitruck.chef.io/install.sh | bash ....

The install.sh tries to use wget (that's the preferred option)

    # do_wget URL FILENAME
    do_wget() {
 echo "trying wget..."
@byrney
byrney / gist:9b1d157675eea874faee6a56280756e5
Created April 26, 2016 21:47 — forked from daicham/gist:10253947
SSH config for connecting github and bitbucket over proxy
ProxyCommand "C:\Program Files\git\bin\connect.exe" -H proxy.example.com:8080 %h %p
Host github.com
HostName ssh.github.com
Port 443
IdentityFile C:\Users\hoge\.ssh\id_rsa
Host bitbucket.org
HostName altssh.bitbucket.org
Port 443
IdentityFile C:\Users\hoge\.ssh\id_rsa
#!/bin/bash
#
# When terminal has "use option key as meta" then opt-3 (hash or pound)
# is not accessible because readline maps it to digit-argument
#
# bind -p | grep e3
# the see the mapping
#
# bind provides a way to remove a mapping `bind -r` but that just leaves us
$ git init
#
# Make some tests commits on master
#
$ echo one > one.txt
$ git commit -am one
$ echo two > two.txt
$ echo three >> one.txt
@byrney
byrney / Vagrantfile
Last active June 21, 2016 19:59
win10-vagrant-issues
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
config.vm.box = "msedge"
config.vm.communicator = "winrm"
config.winrm.transport = :plaintext
config.winrm.basic_auth_only = true
config.vm.guest = :windows # guest detection fails: https://github.com/mitchellh/vagrant/pull/4996
@byrney
byrney / igraph071.txt
Created August 31, 2016 07:12
R Igraph Route Performance
> for(i in c(1,10,25,50, 100)){ print(system.time(x <- do_work(300, i, 50)))}
user system elapsed
0.03 0.02 0.08
user system elapsed
0.03 0.02 0.05
user system elapsed
0.04 0.00 0.06
user system elapsed
0.03 0.00 0.05
user system elapsed