Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
if [ "$1" == "" ]; then
echo Usage: $0 pngfile
exit 0;
fi
FILE=`basename $1 .png`
if [ ! -e $FILE.png ]; then
#' fast_POSIXct
#'
#' Quickly converts local timestamps to a POSIXct vector
#'
#' @param x timestamps (YYYY-mm-dd HH:MM:SS)
#' @param tz local timezone
#' @return POSIXct vector
#' @export
fast_POSIXct <- function(x, tz) {
require(fasttime)
# Drawing a scatter plot of raster images
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("png", "sna")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Go to https://www.gosquared.com/resources/2400-flags, download the ZIP,
# and put the 64 x 64 files into a directory of your choosing.
# Then setwd() to that directory:
setwd("C:/Dropbox/isDotR_Files/flagIcons")
/*
* Takes provided URL passed as argument and make screenshots of this page with several viewport sizes.
* These viewport sizes are arbitrary, taken from iPhone & iPad specs, modify the array as needed
*
* Usage:
* $ casperjs screenshots.js http://example.com
*/
var casper = require("casper").create();
@SantoshSrinivas79
SantoshSrinivas79 / gist:4024730
Created November 6, 2012 13:26 — forked from kafka399/gist:2479226
rsi blotter
rsi2Vix<-function(ticker,vix)
{
getSymbols(c('SPY','VIX'),from='1995-01-01',index.class=c("POSIXt","POSIXct"))
rsi2<-RSI(Cl(SPY),2)
signal<-ifelse(rsi2>90,-1,0)
temp<-ifelse(rsi2<10,1,0)
@SantoshSrinivas79
SantoshSrinivas79 / chartTimeSeries and chartsPerformanceSummary.r
Created November 3, 2012 08:41 — forked from timelyportfolio/chartTimeSeries and chartsPerformanceSummary.r
plot.xts replacements of PerformanceAnalytics chart.TimeSeries and charts.PerformanceSummary
#install.packages("xtsExtra", repos="http://R-Forge.R-project.org")
require(PerformanceAnalytics)
require(xtsExtra) #if you get error, please install xtsExtra from r-forge as shown in the top line
#replicate example provided in chart.TimeSeries with plot.xts
# These are start and end dates, formatted as xts ranges.
## http://www.nber.org-cycles.html
cycles.begin.dates<-c("1857-06",
@SantoshSrinivas79
SantoshSrinivas79 / Heatmap.R
Created September 28, 2012 05:21 — forked from dsparks/Heatmap.R
ggplot2 heatmap with "spectral" palette
# Simple ggplot2 heatmap
# with colorBrewer "spectral" palette
doInstall <- FALSE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "reshape2", "RColorBrewer")
if(doInstall){install.packages(toInstall, repos = "http://cran.us.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Generate a random matrix
# This can be any type of numeric matrix,
@SantoshSrinivas79
SantoshSrinivas79 / pyrocms-permissions.sh
Last active August 7, 2022 11:11
Fix PyroCMS File & Folder Permissions All-In-One
sudo chmod -R 777 system/cms/cache
sudo chmod -R 777 system/cms/config
sudo chmod -R 777 addons
sudo chmod -R 777 system/cms/cache
sudo chmod -R 777 uploads
sudo chmod -R 666 system/cms/config/config.php
App.Tax = Ember.Object.extend({});
App.taxesController = Ember.ArrayController.create({
content: [
{name:"tax1",rate:"10",number_id:"TaxIDNum"},
{name:"tax2",rate:"9",number_id:null}
],
newTax: function() {
this.pushObject(App.Tax.create({}));
},