Skip to content

Instantly share code, notes, and snippets.

@k-nowicki
k-nowicki / Korad_KA_series_driver.rb
Created Apr 13, 2013
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.
View Korad_KA_series_driver.rb
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
@k-nowicki
k-nowicki / lex_killer.rb
Created Jun 15, 2012
Linux Lexmark demon killer
View lex_killer.rb
#!/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