Skip to content

Instantly share code, notes, and snippets.

View znz's full-sized avatar

Kazuhiro NISHIYAMA znz

View GitHub Profile
@znz
znz / battwalker.rb
Created October 8, 2009 00:06
battwalker改変(中途半端でバグあり)
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
=begin
Name: battmonwalker.rb
Version: 0.41
Date: 2009-09-27
Author: moyashi <hitoriblog_NO_NO_SPAM@gmail.com>
Description: Alternate battery status indicator for SHARP NetWalker
Modified by: znz
@znz
znz / visual.c
Created October 14, 2009 12:00
dump my X window props
/* based on http://www.faqs.org/faqs/Xt-FAQ/ 's visual.c */
/*
* Some sample code to start up an application using something other
* than the default visual.
*
* To compile:
* cc -g visual.c -o visual -lXaw -lXmu -lXt -lXext -lX11 -lm
*
* To run:
@znz
znz / otf-unset-isFixedPitch.rb
Created November 24, 2009 12:47
unset isFixedPitch for otf-ipafont
#!/usr/bin/ruby -Kn
# http://www.microsoft.com/typography/otspec/
# http://www.microsoft.com/typography/otspec/otff.htm
# http://www.microsoft.com/typography/otspec/post.htm
def dp(*args)
p(*args) if $DEBUG
end
@znz
znz / fake_key.c
Created December 21, 2009 07:49
XTEST example
/* gcc -o fake_key fake_key.c -lXtst */
/* example usage:
* { sleep 1; ./fake_key l s Return; } &
*/
#include <X11/extensions/XTest.h>
int
main(int argc, char **argv)
{
@znz
znz / gnus-gravatar.el
Created January 21, 2010 23:32 — forked from iratqq/gravatar.el
gravatar for wanderlust and gnus
;;; gravatar.el --- gravatar fetch/store functions
;; Copyright (C) 2008 Iwata
;; Author: Iwata <iratqq@gmail.com>
;; Keywords: faces, tools, extensions, mail
;; This file is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation; either version 3, or (at your option)
@znz
znz / plone-to-html.rb
Created February 25, 2010 09:24
Plone site to static files
#!/usr/bin/ruby
# -*- coding: utf-8 -*-
require 'rubygems'
require 'nokogiri'
require 'logger'
require 'open-uri'
require 'pathname'
require 'set'
@znz
znz / create-redirect.sh
Last active April 16, 2016 09:46
/srv/www の雛形作成
#!/bin/sh
set -ex
SERVER_NAME=$1
SRV_DIR="/srv/www/${SERVER_NAME}"
APACHE2_SITE="/srv/www/${SERVER_NAME}/${SERVER_NAME}.conf"
AWSTATS_CONF="${SRV_DIR}/awstats.${SERVER_NAME}.conf"
AWSTATS_DATA="${SRV_DIR}/awstats"
MAIL_DOMAIN=$(hostname -d)
mkdir -v "$SRV_DIR"
@znz
znz / usbrh
Created June 16, 2010 23:02
munin plugin for usbrh
#!/bin/sh
# munin plugin for usbrh
# see http://znz.s1.xrea.com/t/?date=20100528
case "$1" in
autoconf)
if [ -r /proc/usbrh/0/status ]; then
echo yes
exit 0
else
@znz
znz / fake_keys.c
Created July 24, 2010 19:33
X11で引数の文字列をキー入力したことにする (http://d.hatena.ne.jp/ku-ma-me/20100724/p1 への入力とか)
/* gcc -o fake_keys fake_keys.c -lXtst */
/* example usage:
* ./fake_keys "long string you want to input to x11 application"
*/
#include <X11/Xlib.h>
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>
#include <stdio.h>
int
@znz
znz / addjs.rb
Created September 12, 2010 21:18
旧リファレンスマニュアルからるりまへのリンク生成 (つくりかけというか実験途中)
#!/usr/bin/ruby
s = <<EOF
<script type="text/javascript" src="jquery-1.4.2.js"></script>
<script type="text/javascript" src="linktorurema.js"></script>
EOF
ARGV.each do |fn|
c = open(fn, "rb"){|f|f.read}
c.sub!(/<\/head>/) do
s + $&