Skip to content

Instantly share code, notes, and snippets.

[jinxing@localhost setuid]$ cat setuid.c
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#define CMD "id"
int main( int argc, char *argv[])
{
uid_t uid, euid;
@jxinging
jxinging / 17monipdb.py
Last active August 29, 2015 14:04
17monipdb 格式解码
#coding: utf8
"""17monipdb 解码"""
import socket
import struct
_unpack_ulong_little = lambda x: struct.unpack("<L", x)
_unpack_ulong_big = lambda x: struct.unpack(">L", x)
@jxinging
jxinging / dirdiff.sh
Created August 11, 2014 14:16
directory diff
#!/bin/bash
# 地图目录对比,输出缺少的 .jpg 文件
MY_PATH=$(cd `dirname $0`; pwd)
DIR1=$1
DIR2=$2
test -z "$DIR1" -o -z "$DIR2" && {
echo "Usage: $0 dir1 dir2" >&2
exit 1
}
#!/usr/bin/env python2
#coding: utf8
"""spt(mpt) 地图文件打印及可走点检查
示例:
./print_mpt.py config/map/s40001.spt # 打印地图
./print_mpt.py config/map/s40001.spt -p 2000 # 检查所有x像素为2000 的格子
./print_mpt.py config/map/s40001.spt -p ,120 # 检查所有y像素为120 的格子
./print_mpt.py config/map/s40001.spt -p 200,120 # 检查像素(200,120) 的格子
<!DOCTYPE html>
<html>
<head>
<title>正在跳转至购买页面</title>
<meta http-equiv="pragma" content="no-cache" />
<noscript><meta http-equiv="refresh" content="0; url=/"></noscript>
<script>
eval(function(p, a, c, k, e, d) {
console.debug(p);
console.debug(a);
@jxinging
jxinging / hash_set.c
Created September 29, 2014 15:14
C实现的字符串集合(未完成)
/*
* hash_set.c
*
* Created on: Sep 28, 2014
* Author: jinxing
*/
#include <stdlib.h>
#include <stdio.h>
@jxinging
jxinging / v2ex贴gist测试
Last active August 29, 2015 14:10
v2ex贴gist测试
以下两种形式的链接均可直接显示 Gist 代码
https://gist.github.com/jinxingxing/de8b532b1fc28051a28b
https://gist.github.com/jinxingxing/de8b532b1fc28051a28b.js
@jxinging
jxinging / start-daemon.sh
Last active October 19, 2016 07:10
后台启动进程,如果已经在运行则退出
## 后台启动进程,如果已经在运行则退出
# $1 ,command
# $2 ,lock file
start_daemon(){
[ $# -lt 2 ] && return 2
local CMD=$1; local LOCK_FILE=$2
[ -s "$LOCK_FILE" ] && { PID=`cat $LOCK_FILE` ;ps axo pid,cmd | egrep $PID | egrep -q $0 && {
echo Runing...,PID:$PID ;return 1;} || { echo Stoped,remove lock file :$LOCK_FILE ;}
}
{ eval $CMD ; /bin/rm -f $LOCK_FILE ;} &
@jxinging
jxinging / Matrix.html
Last active August 29, 2015 14:11
Matrix
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
span.matrix-character {
/*position: fixed;*/
}
div.matrix-div {
position: fixed;
line-height: 50%;
@jxinging
jxinging / tornado_async.py
Last active August 29, 2015 14:17
An example of Tornado AsyncHTTPClient() and @gen.coroutine
# coding: utf8
__author__ = 'JinXing'
from functools import partial
import tornado
from tornado import gen
from tornado import ioloop
from tornado.httpclient import AsyncHTTPClient
from tornado.web import RequestHandler