Skip to content

Instantly share code, notes, and snippets.

View dingmingxin's full-sized avatar
🎯
Focusing

EverDing dingmingxin

🎯
Focusing
View GitHub Profile
#!/bin/bash
#
# Build and iPhone Simulator Helper Script
# Shazron Abdullah 2011
#
# WARN: - if your .xcodeproj name is not the same as your .app name,
# this won't work without modifications
# - you must run this script in where your .xcodeproj file is
PROJECTNAME=$1
@dingmingxin
dingmingxin / README.md
Created January 17, 2017 06:47 — forked from Jxck/README.md
libuv TCP server/client sample

how to compile

$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices server.c -o server
$ gcc -g -Wall -I /path/to/libuv/include /path/to/libuv/uv.a -framework CoreServices client.c -o client
@dingmingxin
dingmingxin / libuv-tcp-client.c
Created January 17, 2017 07:29 — forked from snatchev/libuv-tcp-client.c
a libuv evented tcp client
#include <stdio.h>
#include <uv.h>
static void on_close(uv_handle_t* handle);
static void on_connect(uv_connect_t* req, int status);
static void on_write(uv_write_t* req, int status);
static uv_loop_t *loop;
static uv_buf_t alloc_cb(uv_handle_t* handle, size_t size) {
--[[ config
root = "./"
listen = "127.0.0.1:8786"
redisaddr = "127.0.0.1:6379[1]"
dbfile = root .. "backup.db"
thread = 4
logger = nil
harbor = 1
@dingmingxin
dingmingxin / unpack_plist.py
Created April 16, 2017 08:41 — forked from wonkwh/unpack_plist.py
extract image from plist,png file created by texturepacker
#/usr/local/bin/python
import os,sys
from xml.etree import ElementTree
from PIL import Image
def tree_to_dict(tree):
d = {}
for index, item in enumerate(tree):
if item.tag == 'key':
if tree[index+1].tag == 'string':
@dingmingxin
dingmingxin / glm_kazmath.diff
Created July 28, 2017 09:26 — forked from fhssn1/glm_kazmath.diff
Some examples of equivalence of OpenGL math libraries glm (C++) and kazmath (C)
--- p6.cpp 2014-03-28 22:55:37.000000000 -0500
+++ p6.c 2014-03-28 23:02:28.000000000 -0500
@@ -7,9 +7,8 @@
#define PNG_DEBUG 3
#include <png.h>
-#include <glm/glm.hpp>
-#include <glm/gtc/matrix_transform.hpp>
-#include <glm/gtc/type_ptr.hpp>
+#include <kazmath/kazmath.h>
@dingmingxin
dingmingxin / README.md
Created August 25, 2017 07:09 — forked from aldur/README.md
Emoji to JSON

Emoji to JSON

A simple Python script to extract unicode emojis from this page and store their details in a JSON file. Additionally, it also extract the emoji images as PNG files.

Usage

Store the page:

@dingmingxin
dingmingxin / lpegxml.lua
Created August 25, 2017 08:09 — forked from aperezdc/lpegxml.lua
Fairly complete LPeg grammar for parsing XML
--
-- LPeg-based XML parser.
--
-- * Grammar term names are the same as in the XML 1.1
-- specification: http://www.w3.org/TR/xml11/
-- * Action functions are missing.
--
-- Copyright (C) 2012 Adrian Perez <aperez@igalia.com>
-- Distribute under terms of the MIT license.
--
@dingmingxin
dingmingxin / Emacs.md
Created August 29, 2017 08:44 — forked from redinger/Emacs.md
Setting up Emacs daemon on OS X

Setting up Emacs daemon on OS X

Tired of waiting for emacs to start on OS X? This step by step guide will teach you how to install the latest version of emacs and configure it to start in the background (daemon mode) and use emacsclient as your main editor.

Install Cocoa Emacs

Download the latest pretest version of [Emacs for Mac OS X]: http://emacsformacosx.com/builds

@dingmingxin
dingmingxin / ntfs_mount.py
Created September 8, 2017 14:21 — forked from selfboot/ntfs_mount.py
mac os x:自动挂载ntfs硬盘为读写权限。 只要ntfs硬盘连接到电脑即可使用 ./ntfs_mount_auto.py 挂载ntfs磁盘为可读写,ntfs_unmount.py 为卸载磁盘。 ntfs_mount.py 是较早的版本,只有电脑先识别除硬盘,在/Volumes 可读到硬盘内容时才可以使用此脚本挂载为可读写。 建议使用./ntfs_mount_auto.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import subprocess
import re
ntfs_pattern = re.compile(r'File System Personality: NTFS')
ntfs_device_node = re.compile(r'.*Device Node:.*')
device_dict = {}