Skip to content

Instantly share code, notes, and snippets.

@bikong0411
bikong0411 / util.lua
Created June 14, 2016 04:33
常用lua的功能函数
local ffi=require('ffi')
ffi.cdef [[
struct hostent {
char *h_name; /* official name of host */
char **h_aliases; /* alias list */
int h_addrtype; /* host address type */
int h_length; /* length of address */
char **h_addr_list; /* list of addresses */
};
struct hostent *gethostbyname(const char *name);
#!/bin/bash
if [ "$#" -lt 2 ]
then
echo "Scan keys in Redis matching a pattern using SCAN (safe version of KEYS)"
echo "Usage: $0 <host> [port] [database] [pattern]"
exit 1
fi
host=${1:-}
@bikong0411
bikong0411 / getClassFuncForPHP.pl
Created November 2, 2016 10:16
find php function and class in file under a directory
#!/usr/bin/env perl
use feature 'say';
use diagnostics;
use Carp qw/carp croak/;
use IO::File;
use File::Find;
use Data::Dumper;
sub get_class_func($);
sub get_files($);
@bikong0411
bikong0411 / deleteFuncForPHP.pl
Created November 2, 2016 10:18
delete function for php file
#!/usr/bin/env perl
use feature 'say';
use Carp (carp,croak);
use IO::File;
sub del_lines($$);
croak "Usage: file" unless @ARGV ==1;
my $file = shift;
my $fh = IO::File->new($file,'r');
my $fail = IO::File->new("$file.del_fail",'w');
@bikong0411
bikong0411 / count_line.pl
Created November 2, 2016 10:20
统计删除代码行数
#!/usr/bin/env perl
use feature 'say';
use Carp (carp,croak);
use IO::File;
sub getLines($$);
croak "Usage: file" unless @ARGV ==1;
my $file = shift;
my $fh = IO::File->new($file,'r');
my $total=0;
@bikong0411
bikong0411 / iostat.sh
Last active February 14, 2019 07:12
查看某个设备io的读写情况
#!/bin/bash
[ $# -ne 1 ] && echo "Usage: $0 <block_device_name>" && exit
if [ ! -b $1 ]; then
echo "could not find block device $1"
exit
fi
duration=10
echo "running blktrace for $duration seconds to collect data..."