Skip to content

Instantly share code, notes, and snippets.

View anypossiblew's full-sized avatar

Tiven Wang anypossiblew

View GitHub Profile
@anypossiblew
anypossiblew / proxy.js
Created June 12, 2018 15:13
Http proxy server using Nodejs
var http = require('http'),
httpProxy = require('http-proxy');
//
// Create a proxy server with custom application logic
//
var proxy = httpProxy.createProxyServer({});
//
// Create your custom server and just call `proxy.web()` to proxy
@anypossiblew
anypossiblew / picasa-image-filter.js
Created March 24, 2018 14:41
picasa filter star
const fs = require('fs');
const path = require('path');
let basePath = process.argv[2]||".";
var data = fs.readFileSync(basePath + "/.picasa.ini", "utf-8");
let files = data.split("\r\n");
let fileName = "";
let starFiles = {};
files.forEach((line)=> {
@anypossiblew
anypossiblew / railway-proxy.js
Created March 23, 2018 09:58
high speed railway proxy
const request = require('request').defaults({jar: true, encoding: null});
const bodyParser = require('body-parser');
const app = require('express')();
app.use(bodyParser.json()); // for parsing application/json
app.use(bodyParser.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded
function proxy(url) {
const headers = {
"User-Agent": "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.60 Safari/537.17"
@anypossiblew
anypossiblew / AliyunDMUtil.js
Created September 12, 2017 07:59
aliyun 阿里云 > 邮件推送 > 开发指南 > API 参考 > 调用方式 > 签名机制 signature
/**
* created by Tiven Wang on 2017/09/12.
* author: i.tiven.wang@gmail.com
* blog: http://tiven.wang/articles/aliyun-api-signature/
* homepage: http://tiven.wang
*/
var request = require('request');
var crypto = require('crypto');
@anypossiblew
anypossiblew / bluebird.ts
Created June 27, 2017 06:56
Bluebird demo code
var Promise = require("bluebird");
var CloudController = {
getInfo: ()=> {
console.log('get infomation');
return new Promise((reslove, reject)=> {
setTimeout(()=> {
reslove({
authorization_endpoint: ''
});
@anypossiblew
anypossiblew / async-await.ts
Created June 27, 2017 06:26
Async/Await demo code
var CloudController = {
getInfo: ()=> {
console.log('get infomation');
return new Promise((reslove, reject)=> {
setTimeout(()=> {
reslove({
authorization_endpoint: ''
});
}, 0);
});
@anypossiblew
anypossiblew / tj-co.js
Created June 27, 2017 03:01
Automatic generator execution flow
var co = require('co');
var CloudController = {
getInfo: function() {
console.log('get infomation');
return new Promise(function(reslove, reject) {
setTimeout(function() {
reslove({
authorization_endpoint: ''
});
@anypossiblew
anypossiblew / generator.ts
Created June 27, 2017 02:53
User login and get apps flow using Generator
var CloudController = {
getInfo: function() {
console.log('get infomation');
return new Promise(function(reslove, reject) {
setTimeout(function() {
reslove({
authorization_endpoint: ''
});
}, 0);
});
// Enable component-scanning and auto-configuration with @SpringBootApplication Annotation
// It combines @Configuration + @ComponentScan + @EnableAutoConfiguration
@SpringBootApplication
public class FooApplication {
public static void main(String[] args) {
// Bootstrap the application
SpringApplication.run(FooApplication.class, args);
}
}
@anypossiblew
anypossiblew / designer.html
Last active August 29, 2015 14:25
designer
<link rel="import" href="../topeka-elements/theme.html">
<link rel="import" href="../topeka-elements/topeka-resources.html">
<link rel="import" href="../topeka-elements/topeka-app.html">
<link rel="import" href="../topeka-elements/topeka-datasource.html">
<polymer-element name="my-element">
<template>
<style>
:host {