Skip to content

Instantly share code, notes, and snippets.

View harryprince's full-sized avatar
💭
I may be slow to respond.

HarryZhu harryprince

💭
I may be slow to respond.
  • Mobike
  • Jilin University of Finance and Economics
View GitHub Profile
@tompaton
tompaton / kdtree.py
Created March 10, 2011 00:15
Python kd-tree spatial index and nearest neighbour search
#!/usr/bin/env python
# kd-tree index and nearest neighbour search
# includes doctests, run with: python -m doctest kdtree.py
class KDTree(object):
"""
kd-tree spatial index and nearest neighbour search
http://en.wikipedia.org/wiki/Kd-tree
"""
@aaugustin
aaugustin / admin.py
Last active August 7, 2022 19:39
Read-only ModelAdmin for Django
from django.contrib import admin
class ReadOnlyModelAdmin(admin.ModelAdmin):
"""
ModelAdmin class that prevents modifications through the admin.
The changelist and the detail view work, but a 403 is returned
if one actually tries to edit an object.
\documentclass[UTF8,10pt]{ctexart}
\usepackage[a4paper,%%textwidth=129mm,textheight=185mm, %%193-8
text={160mm,260mm},centering]{geometry}
\pagestyle{empty}
\begin{document}
\title{用散点图示范ggplot2的核心概念}
\author{肖凯}
\maketitle
\abstract{
本文稿是第五届R语言会议演讲内容的一部分,试图用散点图示例来说明ggplot2包的核心概念,以方便初学者快速上手。同时这也是笔者应用knitr包的一个练习。该示例所用数据是ggplot2包内带的mpg数据集。}
@suziewong
suziewong / git.md
Last active October 24, 2024 16:44
github的多人协作?how to 贡献代码?

github的多人协作

  1. github上你可以用别人的现成的代码 直接 git clone 即可了

  2. 然后你也想改代码或者贡献代码咋办?

Fork

@gsee
gsee / server.R
Last active January 6, 2020 13:09
simple streaming shiny plot
set.seed(42)
dat <- rnorm(1)
shinyServer(function(input, output) {
fetchData <- reactive(function() {
invalidateLater(1000)
qt <- rnorm(1)
dat <<- c(dat, qt)
dat
})
output$plot_dat <- reactivePlot(function() { plot(fetchData(), type='l') })
@jrnold
jrnold / globaltemp.R
Created February 3, 2013 03:06
Kalman filter in Stan
library(KFAS)
library(rstan)
data(GlobalTemp)
model_dlm1a <- stan_model("../stan/dlm1a.stan")
y <- as.matrix(GlobalTemp)
data <-
within(list(),
{
---
title: Slidify Playground
subtitle: Adapted from OpenCPU MarkdownApp
author: Ramnath Vaidyanathan
framework: io2012
widgets: [mathjax]
---
## Normal Distribution
@withr
withr / server.R
Last active September 3, 2024 07:15
Encrypt password with md5 for Shiny-app.
library(shiny)
library(datasets)
Logged = FALSE;
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad")
# Define server logic required to summarize and view the selected dataset
shinyServer(function(input, output) {
source("www/Login.R", local = TRUE)
observe({
if (USER$Logged == TRUE) {
@staltz
staltz / introrx.md
Last active November 17, 2024 01:08
The introduction to Reactive Programming you've been missing
@thertrader
thertrader / ShinyForTradingStrategy.txt
Last active June 17, 2023 15:59
A Simple Shiny App for Monitoring Trading Strategies
This Shiny application is designed to help analysing trading strategies. It is an ongoing project that I improve when time allows. Feel free to get in touch should you have any suggestion.
*How to use the App as it is?
The App uses as input several csv files (one for each strategy). Each file has two columns: date and daily return. There is an example of such a file in the Github repository. The code is essentially made of 3 files.
-ui.R: controls the layout and appearance of the app
-server.R: contains the instructions needed to build the app. You can load as much strategies as you want as long as the corresponding csv file has the right format (see below).
-shinyStrategyGeneral.R: loads the required packages and launches the app
put ui.R and server.R file in a separate directory
In the server.R file change the inputPath, inputFile and keepColumns parameters to match your setting. The first two are self explanatory the third one is a list of column names within the csv file. Keep only date and daily return