Skip to content

Instantly share code, notes, and snippets.

View shunix's full-sized avatar
:electron:
Focusing

王锐 shunix

:electron:
Focusing
View GitHub Profile
var url = require('url');
var http = require('http');
exports.index = function(req, res){
res.render('index', { title: 'Ingress Shanghai' });
};
exports.getAll = function(req, res){
var data = JSON.stringify({
"desiredNumItems": 1000,
@shunix
shunix / gist:6398514
Created August 31, 2013 14:17
ingress server json format
//
// API.m
// Ingress
//
// Created by Alex Studnicka on 10.01.13.
// Copyright (c) 2013 A&A Code. All rights reserved.
//
#import "API.h"
// http://www.ietf.org/rfc/rfc1928.txt
// Tested with: curl http://www.google.se/ --socks5 1080 --proxy-user foo:bar
var States = {
CONNECTED:0,
VERIFYING:1,
READY:2,
PROXY: 3
};
@shunix
shunix / android-boost.sh
Created December 24, 2013 15:20
Universal Script for Android Phone This universal script boost RAM performance. This universal script mounts all partition as NOATIME This universal script lessen lags on selected applications (MMS / Handcent / DialerOne) This universal script enhances deadline scheduler This universal script performs background process to check screen state
#!/system/bin/sh
#remounting the file systems with noatime and nodiratime flags to save battery and CPU cycles
for k in $(busybox mount | grep relatime | cut -d " " -f3)
do
sync
busybox mount -o remount,noatime,nodiratime $k
done
@shunix
shunix / index.js
Created August 21, 2014 10:59 — forked from edokeh/index.js
//
// _oo0oo_
// o8888888o
// 88" . "88
// (| -_- |)
// 0\ = /0
// ___/`---'\___
// .' \\| |// '.
// / \\||| : |||// \
// / _||||| -:- |||||- \

Create Git Mirror from SVN Repository

This guide will demonstrate how to mirror an SVN into a Git repo. You're the target audience if you're an SVN user, just getting started with Git and need to coax your project team over to Git.

The branching scenario has been simplified for clarity.

References

/* ___====-_ _-====___
* _--^^^#####// \\#####^^^--_
* _-^##########// ( ) \\##########^-_
* -############// |\^^/| \\############-
* _/############// (@::@) \\############\_
* /#############(( \\// ))#############\
* -###############\\ (oo) //###############-
* -#################\\ / VV \ //#################-
* -###################\\/ \//###################-
* _#/|##########/\######( /\ )######/\##########|\#_
@shunix
shunix / MediaFille.java
Created November 11, 2015 06:08
Bypass sdcard write restriction in Android Kitkat
/*
* Copyright (C) 2014 NextApp, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS"
* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language
EXPRESS WITH SEQUELIZE
Well, as this guy said is impossible to put your models in different files due to circular references and multiple sequelize instantiation(?). So, creating a single file is mandatory in order to create complex relationships.
But, you can fix this by putting your models data in different files but setting up sequelize in a single module which loads all the model definitions and holds all the model classes. Obviously, you must have this module as a singleton.
The idea is to have something like this for your model files:
Hello.js:
//Getting the orm instance
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := leveldb
LOCAL_SRC_FILES := \
db/builder.cc \
db/c.cc \
db/db_impl.cc \
db/db_iter.cc \