Skip to content

Instantly share code, notes, and snippets.

Avatar

Almog Melamed Radagaisus

View GitHub Profile
@Radagaisus
Radagaisus / generate_intraday_stocks_dataset.py
Last active Jan 19, 2022
Stocks Dataset using AlphaVantage API
View generate_intraday_stocks_dataset.py
# Stocks Data Assembly and Preprocessing
# ------------------------------------------------------------------------------
import os
import csv
import time
from pathlib import Path
from functools import reduce
import pandas as pd
from alpha_vantage.timeseries import TimeSeries
from argparse_prompt import PromptParser
@Radagaisus
Radagaisus / interpolation_stability.py
Last active Jun 7, 2019
Trying out code from "Using Eigendecomposition to Convert Rotations and Interpolate Operations". Found some numerical stability issues. https://algassert.com/quantum/2016/01/10/eigendecomposition-for-rotation-and-interpolation.html
View interpolation_stability.py
import numpy as np
from scipy.stats import unitary_group
def eigenterpolate(U0, U1, s):
"""Interpolates between two matrices."""
return U0 * eigenpow(U0.H * U1, s)
def eigenpow(M, t):
"""Raises a matrix to a power."""
return eigenlift(lambda b: b**t, M)
@Radagaisus
Radagaisus / DynamicDepthSort.cs
Created Jan 12, 2019
Static and Moving Depth Sort Behaviours for Unity
View DynamicDepthSort.cs
using UnityEngine;
namespace Islands {
[ExecuteInEditMode]
[RequireComponent(typeof(SpriteRenderer))]
public class DynamicDepthSort: MonoBehaviour {
/// <summary>
/// A reference to the game object’s sprite renderer component.
/// </summary>
@Radagaisus
Radagaisus / ThirdPartyNoticesExample.md
Created Oct 20, 2016
Markdown Table from Yarn Licenses (YMMV)
View ThirdPartyNoticesExample.md
@Radagaisus
Radagaisus / captain_up.rb
Created Jul 3, 2015
Ruby, HTTParty, Captain Up
View captain_up.rb
class CaptainUp
# Include HTTParty as a mix-in
include HTTParty
# Set up the base API endpoint
base_uri 'captainup.com'
# Initialize the Captain Up SDK
def initialize(options = {})
@options = options
@Radagaisus
Radagaisus / captain_up_sign_up_modal.js
Created Mar 24, 2015
Hooking into the Captain Up Sign Up Modal
View captain_up_sign_up_modal.js
captain.up(function() {
// Listen to the `signup:open` event, that's triggered whenever the sign up
// modal is opened.
captain.on('signup:open', function() {
// Replace the sign up modal title with "Hello, World!"
$('#cpt-sign-up-modal h1').text('Hello, World!');
});
});
View minimize_captain_up_hud.js
// Asynchronous wrapper around Captain Up, similar to jQuery's DOM ready. Place this
// snippet on every page where you want the HUD to start in minimized state. Place it
// below the Captain Up script embed snippet in your HTML. The code will run immediately
// after Captain Up finished loading.
captain.up(function() {
// Minimizes the HUD, instantly.
captain.hud.minimize({instantly: true});
});
@Radagaisus
Radagaisus / custom_daily_visit_action.coffee
Created Jan 1, 2015
Daily Visit Custom Captain Up Action
View custom_daily_visit_action.coffee
// Only run the code when Captain Up has loaded on the page
captain.up(function() {
// Track a new 'daily_visit' custom action
captain.action('daily_visit', {
// Pass extra data about the action
entity: {
// The current page name
name: captain.get_page_title()
// The referrer URL
referrer: captain.player_info.referrer
@Radagaisus
Radagaisus / nginx.conf
Created Dec 31, 2014
node.js proxy in nginx w/ https
View nginx.conf
http {
upstream node_server {
server 127.0.0.1:2222;
}
server {
listen 443 ssl;
server_name example.com;
ssl on;
@Radagaisus
Radagaisus / sign_user.php
Last active Aug 29, 2015
Captain Up User Integration - Signing a User Object in PHP
View sign_user.php
<?php
// Signs a user object with your API secret.
// See: https://captainup.com/help/javascript/user-integration
//
// @param secret - {String} Your Captain Up API secret
// @param user - {Associative Array} the user dictionary
// @return {String} the signed user string
function sign_user($secret, $user) {
// Remove all `null`, `undefined`, arrays and objects from the object