Skip to content

Instantly share code, notes, and snippets.

@dqtweb
dqtweb / gist:5033fde8ce949686092c27848ecde148
Last active August 27, 2018 06:33
Technical analysis Indicators without Talib
import numpy
import pandas as pd
import math as m
#@author: Bruno Franca
#@author: Peter Bakker
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
@dqtweb
dqtweb / server.js
Created June 16, 2018 14:41 — forked from johannesMatevosyan/server.js
Websockets: send message to all clients except sender.
var http = require('http');
var Static = require('node-static');
var WebSocketServer = new require('ws');
// list of users
var CLIENTS=[];
var id;
// web server is using 8081 port
var webSocketServer = new WebSocketServer.Server({ port: 8081 });
@dqtweb
dqtweb / gist:9c03f9ecf5a3b00d0ea2fb462acf091b
Created June 7, 2018 07:47 — forked from dbrugne/gist:2a62d4dd88f11fa36b75
MongoDB bulk insert from mongoose models
var mongoose = require('mongoose');
var hitSchema = mongoose.Schema({
text: String,
music: String
});
hitSchema.statics.bulkInsert = function(models, fn) {
if (!models || !models.length)
return fn(null);
@dqtweb
dqtweb / Apple Push Notification APNS PHP Snippet.php
Created June 28, 2016 07:33 — forked from manjeshpv/Apple Push Notification APNS PHP Snippet.php
Apple Push Notification APNS PHP Snippet - Server Side Implementation
<?php
$deviceToken = '6e1326c0e4758b54332fab3b3cb2f9ed92e2cd332e9ba8182f49027054b64d29'; // iPad 5s Gold prod
$passphrase = '';
$message = 'Hello Push Notification';
$ctx = stream_context_create();
stream_context_set_option($ctx, 'ssl', 'local_cert', 'pushcert.pem'); // Pem file to generated // openssl pkcs12 -in pushcert.p12 -out pushcert.pem -nodes -clcerts // .p12 private key generated from Apple Developer Account
stream_context_set_option($ctx, 'ssl', 'passphrase', $passphrase);
$fp = stream_socket_client('ssl://gateway.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // production
// $fp = stream_socket_client('ssl://gateway.sandbox.push.apple.com:2195', $err, $errstr, 60, STREAM_CLIENT_CONNECT|STREAM_CLIENT_PERSISTENT, $ctx); // developement