View fourex.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import pylab as pl | |
from numpy import fft | |
def fourierExtrapolation(x, n_predict): | |
n = x.size | |
n_harm = 10 # number of harmonics in model | |
t = np.arange(0, n) | |
p = np.polyfit(t, x, 1) # find linear trend in x | |
x_notrend = x - p[0] * t # detrended x |
View toast.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var toast_top=8; | |
function toast(text,timeoutMs) | |
{ | |
let atoast = document.createElement('div'); | |
with(atoast.style) { | |
backgroundColor='#fef7e6'; border='1px solid #f0ac00'; | |
boxShadow='5px 10px #888888'; color='#000000'; padding='8px'; | |
left="50%"; width='-50%'; top=toast_top+'px'; display='block'; position='fixed'; | |
zIndex=10000; } | |
atoast.innerText=text; |
View eslintFormatter.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// file: node_modules/react-dev-utils/eslintFormatter.js | |
// | |
// I had thousands of errors it is hard to visit each., here is a simple fix, to have | |
// filename with line number for each error | |
// | |
/** | |
* Copyright (c) 2015-present, Facebook, Inc. | |
* |
View applemusic.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* eslint-disable */ | |
! function(e, t) { | |
"object" == typeof exports && "undefined" != typeof module ? t(exports) : "function" == typeof define && define.amd ? define(["exports"], t) : t(e.MusicKit = {}) | |
}(this, function(e) { | |
"use strict"; | |
var t = "undefined" != typeof window ? window : "undefined" != typeof global ? global : "undefined" != typeof self ? self : {}; | |
function unwrapExports(e) { | |
return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e |
View OpenIdRawRequestToken.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package open_id_raw_request_token; | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.io.InputStreamReader; | |
import java.io.OutputStream; | |
import java.io.UnsupportedEncodingException; | |
import java.net.HttpURLConnection; | |
import java.net.MalformedURLException; |
View opencv_helpers.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MatRemoveRows(cv::Mat& matIn, int row, int rowCount=1) | |
{ | |
cv::Size size = matIn.size(); | |
cv::Mat matOut(size.height - rowCount, size.width, matIn.type()); | |
if (!(matIn.isContinuous() && matOut.isContinuous())) throw "both should be continous"; //fix later if required, maybe use the rect solution if not continious https://gist.github.com/enpe/369a7a17fd9b3856b544 OR use as https://kezunlin.me/post/61d55ab4/ | |
int rowSizeInBytes = size.width * sizeof(matIn.elemSize()); |
View money-arithmetics-prototype.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//simple and correct math for money arithmetics | |
Number.prototype.add=function(a){ return parseFloat((this+a).toFixed(15)) }; | |
Number.prototype.sub=function(a){ return parseFloat((this-a).toFixed(15)) }; | |
Number.prototype.mul=function(a){ return parseFloat((this*a).toFixed(15)) }; | |
Number.prototype.div=function(a){ return parseFloat((this/a).toFixed(15)) }; | |
// use with one number each time. | |
// > 0.1.add(0.1).add(0.1).mul(10).div(10) |
View digging through node.js modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function s(m,n){ var x=n&&m.children.filter(function(e){return e.filename.indexOf(n)!=-1})||[]; if(x.length) return x[0]; else console.log(n+' not found',m.children.map(function(e){return e.filename})); } | |
s(require.main) | |
to print a list | |
var xapp=s(require.main,'app') |
View encaspulating header protocol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// encapsulating header protocol: | |
// | |
// FAQ: | |
// | |
// why it is useful?, answer: to minimize use of JSON.parse, which is cpu inefficient. | |
// | |
// where ware it was inteded to be used? answer: on a plain socket or a websocket, like sockjs. | |
// | |
// note: there is a similar "STOMP" protocol, which is simpler(not encapsulating). | |
// |
View php_tiny_curl.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function encodeURIComponent($str) { | |
$revert = array('%21'=>'!', '%2A'=>'*', '%27'=>"'", '%28'=>'(', '%29'=>')'); | |
return strtr(rawurlencode($str), $revert); | |
} | |
class curl_onHeaders | |
{ |
NewerOlder