Skip to content

Instantly share code, notes, and snippets.

View fireflyc's full-sized avatar

fireflyc fireflyc

View GitHub Profile
@fireflyc
fireflyc / tcp_connect.stp
Created January 22, 2018 08:02
systemtap统计TCP连接数量
#!/usr/bin/stap
global connections
global filter_port = 80
//
global report
global spend_time
global active_count
global have_spend_time = 0
@fireflyc
fireflyc / arp_joke.c
Created December 25, 2016 12:43
arp欺骗
#include <pcap.h>
#include <stdlib.h>
#include <libnet.h>
#define log_error(...) fprintf(stderr, __VA_ARGS__)
#define log_info(...) fprintf(stdout, __VA_ARGS__)
#define FALSE (0==1)
#define TRUE (1==1)
typedef struct arp_joke {
@fireflyc
fireflyc / LeaderElection.java
Created September 17, 2016 07:10
Zookeeper Leader Election
public class LeaderElection {
private static Logger LOGGER = LoggerFactory.getLogger(LeaderElection.class);
public static void main(String args[]) throws IOException, KeeperException, InterruptedException {
String connectString = "localhost";
ZooKeeper zooKeeper = new ZooKeeper(connectString, 3000, new Watcher() {
@Override
public void process(WatchedEvent event) {
//无视session超时,连接断开等问题
@fireflyc
fireflyc / gist:ba94b3498074e54f7446
Last active November 2, 2016 13:06
《计算机学报》抓取脚本
import urllib, urllib2, os, traceback, time
from bs4 import BeautifulSoup
root = "http://cjc.ict.ac.cn"
book_root = "/Users/fireflyc/Downloads/"
def post_http(url, param=None, charset=None):
data = None
if(param!=None):
data = urllib.urlencode(param)
@fireflyc
fireflyc / lxc-centos
Created February 23, 2014 03:50 — forked from hagix9/lxc-centos
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors: