Skip to content

Instantly share code, notes, and snippets.

View xiaodaigh's full-sized avatar

evalparse xiaodaigh

View GitHub Profile

20 million digits of pi in under a minute with Julia

I recently discovered a relatively obscure algorithm for calculating the digits of pi: https://en.wikipedia.org/wiki/Gauss–Legendre_algorithm. Well, at least obscure compared to Chudnovsky's. Wikipedia notes that it is "memory-intensive" but is it really? Let's compare to the MPFR pi function:

function gauss_legendre(prec)
    setprecision(BigFloat, prec, base=10)
    GC.enable(false)
@helske
helske / atom_install
Last active September 27, 2019 12:55
Installing Atom and Julia to arbitrary location for non-admin user on Windows
I don't have software installation rights at all with my basic account at work, but I have localadmin rights on a separate account.
But as Atom installs itself automatically to user profile,
I can't just install Atom for my normal account using the localadmin account.
But this works: https://discuss.atom.io/t/how-to-install-atom-on-windows-to-other-places-instead-of-c/27619/12
In summary:
1. Install Atom with localadmin account
2. Run %LocalAppData%\Atom\app-VERSION\atom.exe --squirrel-uninstall VERSION (fill in version with the Semver version of Atom)
3. Move the %LocalAppData%\Atom folder to anywhere you want - make sure to move this root directory, not the app-VERSION directory
4. Run C:\Wherever\you\put\it\Atom\app-VERSION\atom.exe --squirrel-install VERSION
@jcheng5
jcheng5 / helpPopup.R
Created July 2, 2013 21:25
Bootstrap style help popup for Shiny apps
helpPopup <- function(title, content,
placement=c('right', 'top', 'left', 'bottom'),
trigger=c('click', 'hover', 'focus', 'manual')) {
tagList(
singleton(
tags$head(
tags$script("$(function() { $(\"[data-toggle='popover']\").popover(); })")
)
),
tags$a(
@pssguy
pssguy / global.R
Created May 1, 2013 21:14
Shiny App showing ranking of 140+ TV Shows by episode
# load required packages
library(shiny)
library(shinyIncubator)
library(googleVis)
library(ggplot2)
library(stringr)
library(plyr)
library(XML)
library(httr)
library(Hmisc)
@sebfisch
sebfisch / gist:2235780
Created March 29, 2012 10:47
Laymans explanation of delimited continuations with examples of using them for exception handling and nondeterministic programming.

Delimited Continuations

Delimited continuations manipulate the control flow of programs. Similar to control structures like conditionals or loops they allow to deviate from a sequential flow of control.

We use exception handling as another example for control flow manipulation and later show how to implement it using delimited continuations. Finally, we show that nondeterminism can also be expressed using delimited continuations.

Exception Handling