Skip to content

Instantly share code, notes, and snippets.

View vly's full-sized avatar
💭

V L vly

💭
View GitHub Profile
@vly
vly / hma.jl
Created January 4, 2021 23:36
Henderson filter in Julia
"""
Implementation of Henderson filter in Julia.
Followed https://github.com/bpalmer4 python implementation
"""
using DataFrames
function hmaSymmetricWeights(n::Int)
m = (n-1)÷2
m1 = (m+1)^2

Keybase proof

I hereby claim:

  • I am vly on github.
  • I am vly (https://keybase.io/vly) on keybase.
  • I have a public key ASCXqWyKzzJ1Rj2bEToaKU9HxH_64Xvxfa7GqNuIezYr6Qo

To claim this, I am signing this object:

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
# C extensions
*.so
# Distribution / packaging
.Python
env/
@vly
vly / gtm_ou
Created February 19, 2014 05:42
Analytics tracking code
<!-- UoM OU tracking -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-7JB9');</script>
@vly
vly / uomcookie.js
Last active December 29, 2015 23:49
cookie func
/**
* JavaScript BitArray - v0.2.0
*
* Licensed under the revised BSD License.
* Copyright 2010-2012 Bram Stein
* All rights reserved.
*/
var BitArray=function(e,t){this.length=e;this.buffer=new ArrayBuffer(Math.ceil(this.length/32)*4);this.wordArray=new Uint32Array(this.buffer);if(t){t=t.slice(/^0x/.exec(t)?2:0);if(t.length*4>this.length){throw"Hex value is too large for this bit array."}else if(t.length*4<this.length){while(t.length*4<this.length){t="0"+t}}for(var n=0;n<t.length/8;n++){var r=t.slice(n*8,n*8+8);this.wordArray[n]=parseInt(r,16)}}};BitArray.prototype.size=function(){return this.length};BitArray.prototype.set=function(e,t){if(arguments.length!==2){throw"Index and value are required arguments."}if(e>this.length-1){throw"Index too large."+e+" "+this.length}var n=Math.floor(e/32);var r=e-n*32;if(t){this.wordArray[n]|=1<<r}else{this.wordArray[n]&=~(1<<r)}return this};BitArray.prototype.toggle=function(e){if(e>this.length-1){throw"Index too large."}var t=Math.floor(e/32);var n=e-t*32;this.word
@vly
vly / zendesk_addedit.js
Created October 9, 2013 23:16
create an edit button. Paste into the Console.
var test = function() {
var a = $('.answer-official-heading').parent(),
_id = a[0].getAttribute('id').split('-')[1],
_url = window.location.pathname;
_url += '/answers/' + _id + '/edit';
a.children()[1].insertAdjacentHTML('beforeend', '<span class="answer-published"><a href="' + _url + '">Edit</a></span>');
};test()
@vly
vly / zendesk_hc.py
Last active December 24, 2015 23:19
Example script for automating generation of Zendesk Help Centre community q&a threads.
import time
import uuid
import jwt
import requests
import re
# config
SHARED = 'YOUR SHARED KEY'
SUB = 'YOURSUBDOMAIN'
@vly
vly / go_tour_69.go
Created April 21, 2013 09:49
Golang tour #69
package main
import ("code.google.com/p/go-tour/tree"
"fmt"
)
func Walk(t *tree.Tree, ch chan int) {
Walker(t, ch)
close(ch)
@vly
vly / go_tour_60.go
Created April 21, 2013 07:28
Golang tour #60
package main
import (
"io"
"os"
"strings"
)
type rot13Reader struct {
r io.Reader
@vly
vly / go_tour_59.go
Created April 21, 2013 06:32
Golang tour #59
package main
import (
"code.google.com/p/go-tour/pic"
"image"
"image/color"
)
type Image struct{
W, H int