Skip to content

Instantly share code, notes, and snippets.

@k-nowicki
k-nowicki / lex_killer.rb
Created June 15, 2012 20:00
Linux Lexmark demon killer
#!/usr/bin/env ruby
#puts 'Linux Lexmark demon killer by knowicki'
loop do
ps = `ps aux`.scan(/^\S*\s+.*demond.*lexm.*$/)[0]
if ps
pid = ps.split(' ')[1]
`kill #{pid}`
end
sleep 30
end
@k-nowicki
k-nowicki / Korad_KA_series_driver.rb
Created April 13, 2013 17:20
Ruby implementation of KORAD KA series power supplies communication protocol. Verified on KA3005P only, but should work also with all supplies of series, including multichannel ones.
require 'rubygems'
require 'serialport'
class Korad
def initialize(port="/dev/ttyACM0", baud=9600)
@serial = SerialPort::open(port,baud)
@serial.read_timeout = 100
end
def get_status