Skip to content

Instantly share code, notes, and snippets.

grep 'hoge@hogeho.jp' maillog | awk '{print $6}' |parallel 'grep {} maillog'
@negima1976
negima1976 / gist:1496164
Created December 19, 2011 08:54
proftpd-1.3.4a用 NLSTパッチ
--- proftpd-1.3.4a/modules/mod_ls.c 2011-11-06 08:01:58.000000000 +0900
+++ proftpd-1.3.4a/modules/mod_ls_new.c 2011-12-19 16:16:38.000000000 +0900
@@ -1319,10 +1319,8 @@
break;
case 'C':
- if (strcmp(session.curr_cmd, C_NLST) != 0) {
- opt_l = 0;
- opt_C = 1;
- }
@negima1976
negima1976 / ketama-sample.php
Created April 10, 2012 09:38
php sample source
<?php
$m = new Memcached();
$m->addServers(array(
array('hoge', 11211, 30),
array('hoge', 11212, 30),
array('hoge', 11213, 30),
));
$m->setOption(Memcached::OPT_LIBKETAMA_COMPATIBLE, true);
@negima1976
negima1976 / gist:2495321
Created April 26, 2012 02:44
ss_get_by_ssh.php add flare
--- ./ss_get_by_ssh.php 2012-04-26 11:20:50.000000000 +0900
+++ /home/hoge/ss_get_by_ssh.php 2012-04-26 11:39:04.000000000 +0900
@@ -54,6 +54,7 @@
$http_user = 'apache';
$http_pass = '';
$memcache_port = 11211; # Which port memcached listens on
+$flare_port = 12121; # Which port flared listens on
$redis_port = 6379; # Which port redis listens on
# How to get openvz stats
$openvz_cmd = 'cat /proc/user_beancounters';
@negima1976
negima1976 / daily_log_count.awk
Created May 1, 2012 06:23
ログファイルの行数を日付ごとに出力
#/usr/bin/gawk -f
BEGIN {
for (i = 1;i < ARGC;i ++) {
cnt = 0;
while(getline < ARGV[i] > 0) {
cnt ++;
}
print ARGV[i]":"cnt
}
}
@negima1976
negima1976 / hssample.pl
Created November 27, 2012 01:49
HandlerSocket sample code
#!/usr/bin/perl
use strict;
use warnings;
use Net::HandlerSocket;
use Data::Dumper qw/Dumper/;
my $args = { host => 'localhost', port => 9998 };
my $hs = new Net::HandlerSocket($args);
@negima1976
negima1976 / gist:4153253
Created November 27, 2012 09:05
ss_tcp_connections.php
--- ss_tcp_connections_old.php 2012-11-28 02:59:13.074710576 +0900
+++ ss_tcp_connections_new.php 2012-11-28 02:46:47.472714312 +0900
@@ -1,25 +1,30 @@
<?php
-/* do NOT run this script through a web browser */
+require_once 'Console/CommandLine.php';
-if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) {
- die("<br><strong>This script is only meant to run at the command line.</strong>");
+$parser = new Console_CommandLine(array(
@negima1976
negima1976 / gist:6447630
Created September 5, 2013 08:50
perl sample code
#!/usr/bin/perl
use strict;
use warnings;
my $app = sub {
my $env = shift;
return [ 200,
[ 'Content-Type' => 'text/plain' ],
[ "Hello World" ],
];
@negima1976
negima1976 / Makefile
Created November 21, 2013 07:45
net-snmp-config-module install for 64bit
NAME = net-snmp-lvs-module
VERSION=$(shell cat VERSION)
VERSDIR := $(NAME)-$(VERSION)
TARFILE := $(NAME)-$(VERSION).tar.gz
CC := gcc
CFLAGS := -fPIC `net-snmp-config --cflags` -Ilibipvs -I/usr/local/src/linux-2.6.32.27/include -Wall -g
DEFINES := -DHAVE_NET_IP_VS_H
DLFLAGS := -fPIC -shared -g
LIBS := `net-snmp-config --netsnmp-libs`
LIBIPVS := libipvs/libipvs.a
@negima1976
negima1976 / h2o.conf
Last active August 29, 2015 14:27
Nginx + FastCGI + WordPress→h2o + FastCGI + WordPress
user: nobody
listen:
port: 80
host: 0.0.0.0
file.index: ['index.php', 'index.html']
file.send-gzip: ON
file.etag: OFF
expires: 1 day