Skip to content

Instantly share code, notes, and snippets.

View eiyaya's full-sized avatar

stephen zhen eiyaya

  • Beijing. China.
View GitHub Profile
@eiyaya
eiyaya / client.go
Created December 16, 2013 03:32 — forked from spikebike/client.go
package main
import (
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"log"
)
@eiyaya
eiyaya / CmdParser.go
Last active January 1, 2016 12:09
O(1) cmd parser
package main
import "fmt"
type CMD interface {
doAction(user string)
}
type EAT struct {
}
#!/usr/bin/python
#
# This program is intended to be run via sudo, and does the following
# things:
#
# 1. Sets up a high-performance networking environment by tweaking
# various sysctl settings.
# 2. Runs either an interactive shell or a command line program.
# 3. Resets the environment back to what it was.
#!/bin/sh
# Called by "git push" after it has checked the remote status,
# but before anything has been pushed.
#
# If this script exits with a non-zero status nothing will be pushed.
#
# Steps to install, from the root directory of your repo...
# 1. Copy the file into your repo at `.git/hooks/pre-push`
# 2. Set executable permissions, run `chmod +x .git/hooks/pre-push`
import groovyx.net.http.*;
import static groovyx.net.http.ContentType.*;
import static groovyx.net.http.Method.*;
class NexusArtifactCleanup {
/**
* Settings in which to run script.
*/
@eiyaya
eiyaya / apr_md5_generator.c
Last active August 29, 2015 14:10
apache md5 password hash generator
#include <stdio.h>
#include "apr-1/apr_md5.h"
int main(int argc, const char *argv[])
{
if (argc != 3)
{
printf("%s\n", "usage: apr_md5_generator password salt");
return -1;
}
@eiyaya
eiyaya / sshd.go
Last active August 29, 2015 14:12 — forked from jpillora/sshd.go
// A simple SSH server providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
HTTP transfer protocols
=======================
Git supports two HTTP based transfer protocols. A "dumb" protocol
which requires only a standard HTTP server on the server end of the
connection, and a "smart" protocol which requires a Git aware CGI
(or server module). This document describes both protocols.
As a design feature smart clients can automatically upgrade "dumb"
protocol URLs to smart URLs. This permits all users to have the
@eiyaya
eiyaya / app.js
Last active August 29, 2015 14:25 — forked from fidelisrafael/app.js
Easy way to export data to XLS format using Node.js
// clone this gist to a empty folder, the run:
// npm init (and follow steps)
// npm install express --save
// npm install swig --save
// node app.js and open http://localhost:3000
function App() {
var express = require('express');
@eiyaya
eiyaya / grap_sql.sh
Created December 28, 2015 08:59
利用tcpdump抓取mysql sql语句
#!/bin/bash
#this script used montor mysql network traffic.echo sql
tcpdump -i eth0 -s 0 -l -w - dst port 3306 | strings | perl -e '
while(<>) { chomp; next if /^[^ ]+[ ]*$/;
if(/^(SELECT|UPDATE|DELETE|INSERT|SET|COMMIT|ROLLBACK|CREATE|DROP|ALTER|CALL)/i)
{
if (defined $q) { print "$q\n"; }
$q=$_;
} else {
$_ =~ s/^[ \t]+//; $q.=" $_";