Skip to content

Instantly share code, notes, and snippets.

View hjue's full-sized avatar

hjue hjue

  • Beijing, China
View GitHub Profile
@hjue
hjue / dropbox-startup.py
Created December 16, 2013 03:45
dropbox startup script.
# vi /etc/init.d/dropbox
#!/bin/sh
# dropbox service
# Replace with linux users you want to run Dropbox clients for
DROPBOX_USERS="hjue"
DAEMON=.dropbox-dist/dropbox
start() {
echo "Starting dropbox..."
for dbuser in $DROPBOX_USERS; do
@hjue
hjue / server.js
Created December 27, 2013 08:03 — forked from ziahamza/server.js
var http = require('http'),
fs = require('fs'),
path = require('path'),
exec = require('child_process').exec;
function pipeDoc(inputPath, finalType, stream) {
var finalPath = path.dirname(inputPath)
+ "/" + path.basename(inputPath).split('.')[0] + ".html";
var convCommand = 'unoconv -f ' + finalType + " " + inputPath;
exec(convCommand,function(err, stdout, stderr) {
@hjue
hjue / gist:9542489
Last active August 29, 2015 13:57
generate toc of markdown file
<script src="http://code.jquery.com/jquery-1.7.2.min.js"></script>
<link rel="stylesheet" href="http://yandex.st/highlightjs/6.2/styles/googlecode.min.css">
<script src="http://yandex.st/highlightjs/6.2/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script type="text/javascript">
$(document).ready(function(){
$("h2,h3,h4,h5,h6").each(function(i,item){
var tag = $(item).get(0).localName;
#import "MobClickOpenUDID+Swizzled.h"
#import <objc/message.h>
#import <JRSwizzle.h> // Swizzle 类方法,这样可以避免类去调用某些Apple可能不允许的方法,通过审核
#import "YourDevice.h" // 你的设备相关类,用于生成自己的Device Unique ID
#import <RegExCategories.h> // 正则表达式
#import <NSString+Ruby.h> // 字符串工具类
static NSString * const kOpenUDIDKey = @"OpenUDID";
static NSString * const kOpenUDIDSlotKey = @"OpenUDID_slot";
@hjue
hjue / fix-xcode
Created March 15, 2014 15:00 — forked from rnapier/fix-xcode
#!/usr/bin/python
# fix-xcode
# Rob Napier <robnapier@gmail.com>
# Script to link in all your old SDKs every time you upgrade Xcode
# Create a directory called /SDKs (or modify source_path).
# Under it, put all the platform directories:
# MacOSX.platform iPhoneOS.platform iPhoneSimulator.platform
# Under those, store the SDKs:
@hjue
hjue / gist:9617024
Created March 18, 2014 10:00
md文档生成目录(Toc)
<style type="text/css">
#toc ul {margin: 0}
#toc>ul {padding:0}
li.decimal {list-style-type: decimal;}
li.lroman {list-style-type: lower-roman;}
li.lalpha {list-style-type: lower-alpha;}
li,li.square {list-style-type: square}
</style>
<script>
window.onload = function () {
@hjue
hjue / gist:24d004ab2709e6ab57a5
Created May 15, 2014 07:31
ios中将事件添加到系统日历
- (void)saveEvent:(id)sender {
//事件市场
EKEventStore *eventStore = [[EKEventStore alloc] init];
//6.0及以上通过下面方式写入事件
if ([eventStore respondsToSelector:@selector(requestAccessToEntityType:completion:)])
{
#!/bin/bash
# This script automatically sets the version and short version string of
# an Xcode project from the Git repository containing the project.
#
# To use this script in Xcode, add the script's path to a "Run Script" build
# phase for your application target.
set -o errexit
set -o nounset
@hjue
hjue / gist:647dc694dc3b67994202
Created August 16, 2014 13:51
Justwriting的Nginx配置
server {
listen 80;
server_name www.justwriting.com;
root /data/web/www.justwriting.com;
index index.html index.php;
# set expiration of assets to MAX for caching
location ~* \.(ico|css|js|gif|jpe?g|png)(\?[0-9]+)?$ {
expires max;
@hjue
hjue / gist:4da6b1e897de31d135f7
Last active December 28, 2015 18:11
Justwriting Apache conf
配置方法一:
<VirtualHost *:80>
DocumentRoot "/data/web/www.justwriting.com"
ServerName justwriting
<Directory />
Options Indexes FollowSymLinks MultiViews
AllowOverride ALL
Order deny,allow
Allow from all
</Directory>