Skip to content

Instantly share code, notes, and snippets.

View awksedgreep's full-sized avatar

Mark Cotner awksedgreep

View GitHub Profile
@awksedgreep
awksedgreep / multi_frame.py
Created January 25, 2021 22:30
Multi frame asciimatics
from asciimatics.event import KeyboardEvent
from asciimatics.widgets import Frame, Layout, MultiColumnListBox, Widget, Label, TextBox
from asciimatics.scene import Scene
from asciimatics.screen import Screen
from asciimatics.exceptions import ResizeScreenError, StopApplication, NextScene
import sys
class MainFrame(Frame):
def __init__(self, screen, has_border=True, name='MainFrame'):
@awksedgreep
awksedgreep / gist:1321399
Created October 28, 2011 01:18
torquebox 1.x -> 2.x error
Mark-Cotners-Mac-Pro:reflectr mcotner$ jruby -S rake torquebox:deploy[/reflectr]
(in /Users/mcotner/projects/reflectr)
rake aborted!
No TorqueBox deployer installed in /opt/torquebox-current/jboss/server/default/deployers
(See full trace by running task with --trace)
here it is with --trace
Mark-Cotners-Mac-Pro:reflectr mcotner$ jruby -S rake --trace torquebox:deploy[/reflectr]
Can't change resolved type for param: 3 from 23 to 20
org.postgresql.core.v3.SimpleParameterList.setResolvedType(SimpleParameterList.java:230)
org.postgresql.core.v3.QueryExecutorImpl.sendOneQuery(QueryExecutorImpl.java:1488)
org.postgresql.core.v3.QueryExecutorImpl.sendQuery(QueryExecutorImpl.java:1062)
org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)
org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
org.postgresql.jdbc2.AbstractJdbc2Statement.executeQuery(AbstractJdbc2Statement.java:271)
data_objects.Command.execute_non_query(Command.java:151)
data_objects.Command$i_method_0_1$RUBYINVOKER$execute_non_query.call(data_objects/Command$i_method_0_1$RUBYINVOKER$execute_non_query.gen:65535)
#!/usr/bin/env jruby
require 'rexml/document'
require 'net/http'
doc = REXML::Document.new(Net::HTTP.get('dgcsc.org', '/goldprices2.xml'))
# Get current gram price in USD
grams_usd = doc.elements["GoldPrice/Price[@currencycode='USD']"].elements['Ask'].texts.first.to_s.to_f
grams_usd_rounded = sprintf('%.2f', grams_usd)
# Get current ounce price in USD