Skip to content

Instantly share code, notes, and snippets.

View mike820324's full-sized avatar
🎯
Focusing

MicroMike mike820324

🎯
Focusing
View GitHub Profile
@mike820324
mike820324 / worker_gevent.py
Created January 29, 2014 07:36
An example of worker queue model using gevent
import gevent
from gevent.queue import JoinableQueue
from gevent import Greenlet
from gevent.pool import Group
from gevent import monkey
monkey.patch_socket()
monkey.patch_ssl()
import requests
from requests import Session
@mike820324
mike820324 / python_test.py
Created February 3, 2014 08:19
python test for issue 10
def foo(**kargs):
for val,key in kargs.items():
print "{0} -> {1}".format(val, key)
foo(hello_para='hello', world='world')
Please enter a number(1-10): 11
Out of range!
Please enter a number(1-10): 5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Please enter a number (1-10): 11
Out of range!
Please enter a number (1-10): 7
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1
1 6 15 20 15 6 1
Please input a number (1-10): 11
Out of range!
Please input a number (1-10): 5
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
Please input first number (3~10): 0
Out of range!
Please input first number (3~10): 8
Please input second number (3~10): 11
Out of range!
Please input second number (3~10): 8
1 1 0 0 0 1 1 1
1 1 1 1 1 0 0 1
0 0 1 0 0 1 1 0
1 0 0 1 0 0 1 1
Please input a number (1~10):
0
Out of range!
Please input a number (1~10):
11
Out of range!
Please input a number (1~10):
8
1
1 1
package ce1002.a2.s102522042;
import java.util.Scanner;
public class A2 {
public static void main(String[] args) {
Scanner input = new Scanner( System.in );
package ce1002.a2.ta;
import java.util.Scanner;
public class A2 {
public static void main(String[] args) {
Scanner input = new Scanner( System.in );
@mike820324
mike820324 / SystemCallHooking.c
Created June 27, 2014 18:43
An example of Hooking Linux System Call
#include <linux/module.h>
#include <linux/printk.h>
#include <linux/fs.h>
#include <linux/sched.h>
#include <asm/unistd.h>
#include <asm/pgtable_types.h>
#include <linux/highmem.h>
#include "hook_function_ptr.h"