Skip to content

Instantly share code, notes, and snippets.

View nogweii's full-sized avatar
🍀

Nogweii nogweii

🍀
View GitHub Profile
@nogweii
nogweii / module_methods.rb
Last active August 29, 2015 13:56
Example module code for #ruby on Freenode
module MyBase
def big_function
@_memoized_big_function ||= begin
load_lots_of_data(SettingsManager.foo_bar)
end
end
module_method :big_function
public :big_function
end
jp2a picture.jpg --colors --invert | head -n20 | sed 's/\^[\[37m \^[\[0m/ /g' > picture.ansi
@nogweii
nogweii / plugin.rb
Last active August 29, 2015 13:57
steam login plugin for discourse
# name: discourse-steam
# about: VALVE's Steam login support for Discourse
# version: 0.0.1
# authors: Colin Shea
auth_provider :title => 'with Steam',
:authenticator => Auth::OpenIdAuthenticator.new('steam','http://steamcommunity.com/openid', trusted: true),
:message => 'Authenticating with Steam (make sure pop up blockers are not enabled)',
:frame_width => 1000, # the frame size used for the pop up window, overrides default
:frame_height => 800
@nogweii
nogweii / hipchat_hooks.rb
Created March 6, 2014 00:26
A script to set up HipChat hooks on every repository in an organization
#!/usr/bin/ruby
# Script to set up HipChat on every repository in an Organization.
# Is idempotent -- doesn't make a hook if there already is a HipChat
# notification set up.
require 'octokit'
## Settings
# What organization should we set up?
@nogweii
nogweii / arizona_life.geojson
Created August 8, 2014 06:37
My life thus far in Arizona. Playing with mapbox tools, like http://geojson.io/
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@nogweii
nogweii / shellshock_test.sh
Last active August 29, 2015 14:07
Quickie test for shell shock.
#!/bin/bash
# A quick shell script that outputs "VULNERABLE!" if you are vulnerable, nothing
# otherwise. Meant to be used as part of an automated framework.
#
# Based on [bashcheck](https://github.com/hannob/bashcheck).
#
# These tests are *incomplete!* This is missing the tests for CVE-2014-6277 &
# CVE-2014-6278, as updated bashes aren't widely available yet, so they will
# always trigger.
#!/bin/zsh
screens=($(screen -ls | head -n-2 | tail -n +2))
# Zero index of an array is empty. Start at index 1.
#count=$(($#screens+1))
#i=1
#while [[ $i < $count ]]; do
# echo $screens[$i] $screens[$(($i+1))]
# i=$((i + 2))
#done
<html>
<head>
<title>WishList</title>
</head>
<body>
<h4>Wishlist for the Shea family</h4>
<? if @items == {} ?>
No items, go add one!
<? else ?>
<ul>
undefined local variable or method `item' for #<MainController:0xb78e62e8>
view/index.xhtml:19:in `binding'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action.rb:109:in `binding'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action.rb:109:in `instance_eval'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action.rb:109:in `binding'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/template/ezamar.rb:24:in `transform'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action/render.rb:114:in `uncached_render'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action/render.rb:39:in `render'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action/render.rb:11:in `stack'
/usr/lib/ruby/gems/1.8/gems/ramaze-2008.11/lib/ramaze/action/render.rb:28:in `render'
class MainController < Ramaze::Controller
def index
@items = {}
# pp WishList.original
WishList.original.each do |id, tags|
@items[tags[:item]] = tags.reject {|k,v| k == :item }
end
pp @items
"List of all entires"
end