Skip to content

Instantly share code, notes, and snippets.

View kdwinter's full-sized avatar

Kenneth De Winter kdwinter

  • Belgium
  • 16:21 (UTC +02:00)
View GitHub Profile
#!/usr/bin/env ruby
@paclist = `pacman --query`
@listfile = ENV['HOME'] + '/paclist.txt'
@today = Time.now.strftime("%d %m %Y, %T")
f = File.new(@listfile, 'w+')
f.write(<<EOF
Pacman package list as of #{@today}:
#!/bin/sh
#
# ~/.xinitrc
xset m 0 3 &
xsetroot -cursor_name left_ptr -solid "#090909" &
urxvtd -o -q -f &
unclutter -idle 5 -root &
# Fix java apps
wmname compiz &
#!/usr/bin/env ruby
require 'procfile_parser'
module Moc
def self.run
moc = ProcFile.new(IO.popen("mocp --info"))[0]
@state = { :play => :playing, :pause => :paused, :stop => :stopped }[moc["State"].downcase.to_sym]
@file = moc["File"]
@title = moc["Title"]
moc = ProcFile.new(IO.popen("mocp --info"))[0]
@state = { :play => :playing, :pause => :paused, :stop => :stopped }[moc["State"].downcase.to_sym]
@file = moc["Fil@title = moc["Title"]
@artist = moc["Artist"]
@song_title = moc["SongTitle"]
@album = moc["Album"]
@total_time = moc["TotalTime"]
@time_left = moc["TimeLeft"]
@total_sec = moc["TotalSec"].to_i
@current_time = moc["CurrentTime"]
#!/usr/bin/env ruby
class ProcFile
include Enumerable
def self.parse_file(file)
file = File.expand_path(file, "/proc")
new(File.new(file))
end
File.open(ENV['HOME'] + '/.config/awesome/awesomerc.lua').each_line do |line|
if line.match(/theme_path\ =/ix)
@wmtheme = line.gsub(/theme_path\ =/ix, '').strip.chomp
end
end.close
#!/usr/bin/env ruby
# Script that generates system info, useful for screenshots.
# Inspired by 'info.pl'.
# Author: Gigamo <gigamo@gmail.com>
## Configuration
@display = {
:os => true, # Display OS name
:kl => true, # Display Kernel version
:wm => true, # Display Window Manager
#!/usr/bin/perl
# Author: Todd Larason <jtl@molehill.org>
# $XFree86: xc/programs/xterm/vttests/256colors2.pl,v 1.2 2002/03/26 01:46:43 dickey Exp $
# use the resources for colors 0-15 - usually more-or-less a
# reproduction of the standard ANSI colors, but possibly more
# pleasing shades
# colors 16-231 are a 6x6x6 color cube
for ($red = 0; $red < 6; $red++) {
#!/usr/bin/env ruby
def add(n=0, m=0)
n + m
end
def subtract(n=0, m=0)
n - m
end
#!/usr/bin/env ruby
%w(rudo test/unit).each do |lib|
require lib
end
module Rudo
class TestRudo < Test::Unit::TestCase
def setup
@@todo_file = ENV['HOME'] + '/tmp/todo_test.txt'