Skip to content

Instantly share code, notes, and snippets.

View lak's full-sized avatar

Luke Kanies lak

View GitHub Profile
@lak
lak / Virus links to convince people
Last active March 12, 2020 15:19
Links collected to help convince people of the importance of treating COVID-19 seriously
#!/usr/bin/ruby -w
require 'optparse'
options = {}
option_parser = OptionParser.new do |parser|
parser.banner = "Usage: git-branch-cleanup [options]
Deletes already-merged branches from local repository.
#!/usr/bin/env ruby
## git-publish-branch: a simple script to publish the current branch
## to your origin repository, and then track that so you can easily
## push further updates.
##
## Opens the URL for a pull request after pushing.
##
## Usage: git publish-branch
##
@lak
lak / download.rb
Created August 28, 2016 20:01
Simplistic calendar analysis
#!/usr/bin/ruby
require 'google/apis/calendar_v3'
require 'googleauth'
require 'googleauth/stores/file_token_store'
require 'fileutils'
SETTINGS = OpenStruct.new(
:oob_uri => 'urn:ietf:wg:oauth:2.0:oob',
@lak
lak / Mail2Trello
Last active October 22, 2016 14:16
A simple (and lame) script for forwarding an email to Trello, and including a URL for the message ID of the message. This makes it so you can click on the URL in trello and have the original email opened up in Mail.
on log_err(message)
display notification message
log message
end log_err
on run
try
tell application "Mail"
set theAddress to "<email>@boards.trello.com"
### Keybase proof
I hereby claim:
* I am lak on github.
* I am lak (https://keybase.io/lak) on keybase.
* I have a public key whose fingerprint is CF1B 22E4 F4A2 C6A8 9F08 1114 6537 984C A2C4 AC7E
To claim this, I am signing this object:
luke@syringe $ rspec spec/unit/parser/scope_spec.rb spec/unit/parser/functions/versioncmp_spec.rb
...............................................................................FFF
Failures:
1) the versioncmp function should raise a ParseError if there is less than 2 arguments
Failure/Error: lambda { @scope.function_versioncmp(["1.2"]) }.should raise_error(Puppet::ParseError)
expected Puppet::ParseError, got #<NoMethodError: undefined method `function_versioncmp' for #<Puppet::Parser::Scope:0x102008e50>>
# ./spec/unit/parser/functions/versioncmp_spec.rb:18
@lak
lak / gist:941981
Created April 26, 2011 08:30
Using VIM to create html renderings of code
# vim: syntax=ruby
require 'bluecloth'
require 'erb'
outputs = []
FileList['examples/*'].each do |input|
output = File.join("output", File.basename(input)).sub(/\.\w+/, ".html")
outputs << output
@lak
lak / gist:916894
Created April 13, 2011 03:12
json support within Puppet.
luke@syringe $ ruby -rpuppet -rpuppet/network/format_handler -e 'f = Puppet::Network::FormatHandler.format(:pson); k = Puppet::Indirector::Indirection; k.instances.collect { |n| k.instance(n).model }.each { |k| puts "%-40s: #{f.supported?(k)}" % k }'
Puppet::Node::Facts : true
Puppet::Node::Inventory : false
Puppet::Node : false
Puppet::Transaction::Report : false
Puppet::Resource : true
Puppet::Resource::Type : true
Puppet::Resource::Catalog : true
Puppet::SSL::Key : false
Puppet::SSL::Certificate : false
luke@syringe $ md5sum /tmp/baz
e31be87da5b8002afc983eecd1e29223 /tmp/baz
luke@syringe $ echo asdfasdf >> ~/etc/puppet/modules/mymod/files/myfile
luke@syringe $ puppet agent --verbose --test --server localhost
info: Caching catalog for localhost
info: Applying configuration version '1302126831'
--- /tmp/baz 2011-04-06 14:51:40.000000000 -0700
+++ /var/folders/8B/8BmBDildHw40ZzYiLHHQuk+++TI/-Tmp-/puppet-file20110406-29205-xza4j7-0 2011-04-06 14:53:52.000000000 -0700
@@ -1,2 +1,4 @@
mainfile