Skip to content

Instantly share code, notes, and snippets.

@sergeykish
sergeykish / named-image-message.py
Created April 10, 2011 14:18
access /dev/draw from C, rc, python, ruby, go
# C
% ./8.out
4 1 x8r8g8b8 0 83 41 889 739 83 41 889 739
# rc, message by python
% named-image.rc
close failed: [Errno 12] Invalid argument
5 1 x8r8g8b8 0 83 41 889 739 83 41 889 739
% python named-image.py
@sergeykish
sergeykish / ruby-1.8.6-p230.patch
Created April 1, 2011 17:13
Plan 9 diff and patch
% ape/patch -p1 --verbose <../ruby-1.8.6-p230.patch
Hmm... Looks like a normal diff to me...
can't find file to patch at input line 3
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|Only in ruby-1.8.6-p230: draw.rb
|diff ruby-1.8.6-p230-origin/file.c ruby-1.8.6-p230/file.c
--------------------------
File to patch:
@sergeykish
sergeykish / gist:877660
Created March 19, 2011 17:51
ruby on plan9
term% ape/psh
$ make
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c array.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c bignum.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c class.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c compar.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c dir.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c dln.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c enum.c
cc -D_POSIX_SOURCE -D_BSD_EXTENSION -DPLAN9 -DT386 -DRUBY_EXPORT -I. -I. -c error.c
@sergeykish
sergeykish / gist:875820
Created March 18, 2011 09:30
alsa configuration
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: VT1708S Analog [VT1708S Analog]
Subdevices: 1/2
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
card 0: Intel [HDA Intel], device 1: VT1708S Digital [VT1708S Digital]
Subdevices: 1/1
Subdevice #0: subdevice #0
@sergeykish
sergeykish / fine if define in irb
Created February 17, 2011 13:33
oh! what's wrong?
$ irb --simple-prompt
>> module Connection; end
=> nil
>> module Redis
>> class Connection
>> end
>> end
=> nil
>> Redis::Connection.class
=> Class
@sergeykish
sergeykish / gist:801135
Created January 28, 2011 22:31
HTML is not hard
$ mkdir site
~$ cd site/
~/site$ cat >index.html
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Home</title>
<p>Welcome to our site! We've already made several pages:</p>
<style>
html { background:white; }
body { background:cyan; }
h1 { margin-top:50px; }
</style>
<p>hello</p>
<h1>I'm header!</h1>
@sergeykish
sergeykish / info from linux
Created January 17, 2011 14:35
hardware in plan9
$ lspci
00:00.0 Host bridge: Intel Corporation System Controller Hub (SCH Poulsbo) (rev 07)
00:02.0 VGA compatible controller: Intel Corporation System Controller Hub (SCH Poulsbo) Graphics Controller (rev 07)
00:1b.0 Audio device: Intel Corporation System Controller Hub (SCH Poulsbo) HD Audio Controller (rev 07)
00:1c.0 PCI bridge: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 1 (rev 07)
00:1c.1 PCI bridge: Intel Corporation System Controller Hub (SCH Poulsbo) PCI Express Port 2 (rev 07)
00:1d.0 USB Controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #1 (rev 07)
00:1d.1 USB Controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #2 (rev 07)
00:1d.2 USB Controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB UHCI #3 (rev 07)
00:1d.7 USB Controller: Intel Corporation System Controller Hub (SCH Poulsbo) USB EHCI #1 (rev 07)
@sergeykish
sergeykish / Makefile
Created January 12, 2011 15:24
make with default rules
all: example
@sergeykish
sergeykish / getxkbgroupsymbols.c
Created January 4, 2011 17:59
Xorg get current layout
#include <stdio.h>
#include <X11/XKBlib.h>
int
main()
{
char* displayName = "";
int eventCode;
int errorReturn;
int major = XkbMajorVersion;