For excessively paranoid client authentication.
Updated Apr 5 2019:
because this is a gist from 2011 that people stumble into and maybe you should AES instead of 3DES in the year of our lord 2019.
some other notes:
| #!/usr/bin/python -u | |
| """ | |
| Python port of PHP serialize() and unserialize() | |
| by Samuel Cochran <sj26@sj26.com> | |
| I couldn't find a nice, fairly efficient implementation of serialize/unserialize for Python... so I wrote one. I didn't use str().partition because I wanted Python <2.5 compatibility. | |
| TODO: Performance review. There's an awful lot of string copying. >.> |
| ######################################### | |
| ## GLOBAL REQUIREMENTS AND DEFINITIONS ## | |
| ######################################### | |
| require(RCurl) | |
| require(XML) | |
| loginURL <- "https://accounts.google.com/ServiceLogin" | |
| authenticateURL <- "https://accounts.google.com/accounts/ServiceLoginAuth" | |
| insightsURL <- "http://www.google.com/insights/search/overviewReport" |
| ip2Int <- function(ip){ | |
| split <- as.numeric(strsplit(ip, "\\.")[[1]]) | |
| out <- (split[1] * 256^3) + (split[2] * 256^2) + (split[3] * 256) + (split[4]) | |
| return(out) | |
| } | |
| int2Ip <- function(int){ | |
| split <- NULL | |
| split[1] <- as.integer(int/256^3) |
| ##################################################################################### | |
| # Q-Q plot in ggplot2 | |
| # taken from http://stackoverflow.com/questions/4357031/qqnorm-and-qqline-in-ggplot2 | |
| ##################################################################################### | |
| require(ggplot2) | |
| vec <- Hg$AMT # whateer | |
| y <- quantile(vec[!is.na(vec)], c(0.25, 0.75)) |
| # remove non-ascii characters | |
| df$text <- gsub("[^\x20-\x7E]", "", df$text) |
| cmake_minimum_required(VERSION 2.8) | |
| project(RcppPackage) | |
| find_package(LibR) | |
| if(${LIBR_FOUND}) | |
| else() | |
| message(FATAL_ERROR "No R...") | |
| endif() | |
| message(STATUS ${CMAKE_SOURCE_DIR}) | |
| execute_process( | |
| COMMAND ${LIBR_EXECUTABLE} "--slave" "-e" "stopifnot(require('Rcpp'));cat(Rcpp:::Rcpp.system.file('include'))" |
| vif_func<-function(in_frame,thresh=10,trace=T,wts=NULL,...){ | |
| library(fmsb) | |
| if(any(!'data.frame' %in% class(in_frame))) in_frame<-data.frame(in_frame) | |
| if(is.null(wts)) | |
| wts <- rep(1, ncol(in_frame)) | |
| if(!is.null(wts)) | |
| if(length(wts)!=ncol(in_frame)) stop('length of weights must equal number of variables') |
| library("shiny") | |
| library("foreign") |