Skip to content

Instantly share code, notes, and snippets.

View kyle-go's full-sized avatar
🌴
On vacation

Kyle kyle-go

🌴
On vacation
View GitHub Profile
@kyle-go
kyle-go / compile-java.md
Last active August 29, 2018 03:03
How compile java to jar?

Main.java内容为:

package com.company;

public class Main {
    public static void main(String[] args) {
        System.out.println("Hello Java!");
    }
}
@kyle-go
kyle-go / flaskwithcron.py
Created March 22, 2016 06:47 — forked from chadselph/flaskwithcron.py
flask with "cron"-like loop
from flask import Flask, render_template, jsonify, request
from threading import Timer, Thread
from time import sleep
app = Flask(__name__)
@app.route("/api/<method>")
def api(method):
data = {
@kyle-go
kyle-go / regex.cpp
Last active January 27, 2016 03:40
c++ regex
#include "stdafx.h"
#include <regex>
using namespace std;
int main()
{
string str = "xxxABC999yjdskABC444阿凡ABC0_达ABC77汉字eABC9";
const regex reg("ABC[0-9]+");
smatch results;
@kyle-go
kyle-go / tool.py
Last active January 26, 2016 12:50
python小爬虫
from urllib import urlencode
import cookielib, urllib2, urllib, re, os
_loginweb = "http://0.0.0.0:8080/"
_userinfo = { 'os_username': "wangkangan",
'os_password': "***",
'os_cookie':'true'}
def issue(opener, issue):
op = opener.open(_loginweb + "browse/" + issue + "?page=com.atlassian.jira.plugin.ext.subversion:subversion-commits-tabpanel")
@kyle-go
kyle-go / macro
Last active August 29, 2015 13:57
http header宏定义问题,解决方案
//复杂的宏实现,效率确实比较高一些,但有点小瑕疵,需要继续分割“//”才能消除警告
#define _ToStr(x) #x
#define __ToStr(x) _ToStr(x)
#define HTTP_HEADER http:/\/www.google.com/
#define WEBSITE_INDEX1 @__ToStr(HTTP_HEADER)"index1.html"
#define WEBSITE_INDEX2 @__ToStr(HTTP_HEADER)"index2.html"
@kyle-go
kyle-go / c++ map
Last active August 29, 2015 13:56
std::<int, std::string>map,删除key(first)小于20的元素。
#include <map>
#include <string>
void print(const std::map<int, std::string> &map)
{
for (auto it=map.begin(); it!=map.end(); it++) {
printf("key = %d, value=%s\n", it->first, it->second.c_str());
}
}
@kyle-go
kyle-go / getFirstPinyinChar
Created January 20, 2014 02:20
getFirstPinyinChar
- (char)getFirstPinyinChar:(NSString *)text {
NSInteger index = [[UILocalizedIndexedCollation currentCollation] sectionForObject:text collationStringSelector:@selector(self)];
NSString *englishLetter = [[[UILocalizedIndexedCollation currentCollation] sectionIndexTitles] objectAtIndex:index];
return [englishLetter characterAtIndex:0];
}
@kyle-go
kyle-go / KHookObjectWrapper.h
Last active March 27, 2017 10:13
KHookObjectWrapper
//
// KHookObjectWrapper.h
// ObjectHook
//
// Created by kyle on 13-12-13.
// Copyright (c) 2013年 kyle. All rights reserved.
//
#import <Foundation/Foundation.h>
@kyle-go
kyle-go / gist:7332390
Last active December 27, 2015 13:19
macro.h
//
// macro.h
//
// create by kyle. 2013.11
// https://gist.github.com/kylescript/7332390
#ifdef DEBUG
#define debugLog(...) NSLog(__VA_ARGS__)
#define debugMethod() NSLog(@"%s", __func__)
#else
@kyle-go
kyle-go / AFTextResponseSerializer.h
Last active December 26, 2015 21:19 — forked from okitsutakatomo/AFTextResponseSerializer.h
AFNetworking2.0Request failed: unacceptable content-type: text/plain解决方法 ref: http://qiita.com/okitsutakatomo/items/21b126fb1e3dae3bcb2f
#import "AFURLResponseSerialization.h"
@interface AFTextResponseSerializer : AFHTTPResponseSerializer
@end