Skip to content

Instantly share code, notes, and snippets.

@tknv
tknv / mood2twit
Created April 7, 2010 08:11
mood2twit
#! ruby -Ku
# mood2twit.rb
require 'rubygems'
require 'win32ole'
require 'twitter'
require 'kconv'
$KCODE = 'UTF8'
@tknv
tknv / death_agony.rb
Created April 7, 2010 08:18
death agony!!!
# death_agony.rb
#! ruby -Ku
require 'rubygems'
require 'win32ole'
require 'kconv'
$KCODE = 'UTF8'
@MACHINE = ARGV[0]
@GOD = ARGV[1]
<fop version="1.0">
<base>file:/C:/Program Files/Oxygen XML Author 11/</base>
<source-resolution>72</source-resolution>
<target-resolution>72</target-resolution>
<default-page-settings height="11in" width="8.26in"/>
<renderers>
<renderer mime="application/pdf">
<filterList>
<value>flate</value>
</filterList>
cd your-repo
git init
git remote add origin git@YOUR_SERVER_HOSTNAME:your-repo.git
# do some work, git add and commit files
# should commit some,otherwise repo refs not def error
git push origin master:refs/heads/master
@tknv
tknv / sites-available-default.conf
Created November 30, 2010 08:32
nginx config for cgit and any cgi with SimpleCGI
server {
listen 80;
# Serve static files
location ~* ^.+\.(css|png|ico)$ {
root /var/www/htdocs;
expires 30d;
}
if (!-f $request_filename) {
@tknv
tknv / nginx.config
Created November 30, 2010 09:06
nginx.config
user www-data;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
# multi_accept on;
}
@tknv
tknv / cgitrc
Created November 30, 2010 09:22
/etc/cgitrc
virtual-root=/
cache-size=1000
enable-index-links=1
enable-log-filecount=1
enable-log-linecount=1
max-stats=quarter
root-title=tknv git repositories
root-desc=tracking the tknv development
root-readme=/var/www/htdocs/about.html
snapshots=tar.gz tar.bz2 zip
@tknv
tknv / cgiwrap-fcgi.pl
Created November 30, 2010 09:38
SimpleCGI /usr/local/bin/cgiwrap-fcgi.pl
#!perl
use FCGI;
use Socket;
use FCGI::ProcManager;
sub shutdown { FCGI::CloseSocket($socket); exit; }
sub restart { FCGI::CloseSocket($socket); &main; }
use sigtrap 'handler', \&shutdown, 'normal-signals';
use sigtrap 'handler', \&restart, 'HUP';
require 'syscall.ph';
use POSIX qw(setsid);
@tknv
tknv / menu
Created March 28, 2011 07:15
add Power manage
[submenu] (Power manage) {}
[exec] (Conservative Power) {cpufreq-selector -g conservative} <>
[exec] (On-Demand Power) {cpufreq-selector -g ondemand} <>
[exec] (Performance Power) {cpufreq-selector -g performance} <>
[exec] (Save Power) {cpufreq-selector -g powersave} <>
[end]
@tknv
tknv / death_agony.rb
Created April 19, 2011 14:38
death_agony.rb
# death_agony.rb
#! ruby -Ku
require 'rubygems'
require 'win32ole'
require 'kconv'
$KCODE = 'UTF8'
@MACHINE = ARGV[0]
@GOD = ARGV[1]