Skip to content

Instantly share code, notes, and snippets.

################################################################################
## Experiment with PSO
################################################################################
## make data
mu <- 5
sigma <- 10
Y <- rnorm(1000,mu,sigma)
@MarcoDVisser
MarcoDVisser / RandomFileRename.sh
Last active August 29, 2015 14:05
Random File Rename for random wallpaper in Linux
#!/bin/bash
# Seed random generator
RANDOM=$$$(date +%s)
# read all jpg files in folder
# replace the $( ) with '' for older versions
# creates an array of all the files in ~/bin/images/wp
FILES=(~/bin/images/wp/*)
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("ggplot2", "proxy")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
nIncrements <- 36
eachIncrement <- seq(0, 1, len = nIncrements)
colorSweep <- expand.grid(eachIncrement, eachIncrement, eachIncrement)
moduloRemainder <- with(colorSweep, Var1*(nIncrements-1)) %%
floor(sqrt(nIncrements))