View collection.rb
require 'json'
TWURL_HEAD_POST = 'twurl -X POST "/1.1/collections/'
TWURL_HEAD_GET = 'twurl "/1.1/collections/'
COM_CREATE = TWURL_HEAD_POST + 'create.json?timeline_order=curation_reverse_chron&name='
COM_DESTROY = TWURL_HEAD_POST + 'destroy.json?id='
COM_ADD = TWURL_HEAD_POST + 'entries/add.json'
COM_LIST = TWURL_HEAD_GET + 'list.json?screen_name='
View HSLColor.scala
import java.awt.Color
object HSLColor {
def RGBtoHSL(r255: Int, g255: Int, b255: Int) : HSLColor = {
val r = r255 / 255f
val g = g255 / 255f
val b = b255 / 255f
val min = Math.min(r, Math.min(g, b))
val max = Math.max(r, Math.max(g, b))
View Keys.scala
object Keys {
val CONSUMER_KEY = "CONSUMER_KEY"
val CONSUMER_SECRET = "CONSUMER_SECRET"
val ACCESS_TOKEN = "ACCESS_TOKEN"
val ACCESS_TOKEN_SECRET = "ACCESS_TOKEN_SECRET"
}
View Random.scala
import scala.util.{Random => SRandom}
import java.security.SecureRandom
import org.apache.commons.math3.random.RandomAdaptor
import org.apache.commons.math3.random.MersenneTwister
import org.apache.commons.math3.random.ISAACRandom
object Random {
def MT(seed: Long) : SRandom = new SRandom(new RandomAdaptor(new MersenneTwister(seed)))
def MT : SRandom = MT(new SecureRandom().nextLong())
View get_access_token.groovy
import twitter4j.*
import twitter4j.conf.ConfigurationBuilder
final CONSUMER_KEY = "CONSUMER_KEY"
final CONSUMER_SECRET = "CONSUMER_SECRET"
cb = new ConfigurationBuilder()
cb.setDebugEnabled(true)
.setOAuthConsumerKey(CONSUMER_KEY)
.setOAuthConsumerSecret(CONSUMER_SECRET)
View acceldif.R
# acceldif.R
printf = function(...) invisible(print(sprintf(...)))
R = 1:20
H = 2^(-(R+2))
f = function(x) exp(x)
err = function(x) abs(x - f(1)) / f(1)
View acceldif.jl
#acceldif.jl
R = 1:20
h = [2.0^(-k) for k in R + 2]
f(x) = exp(x)
err(x) = abs(x - f(1)) / f(1)
dif_f(h) = (f(1 + h) - f(1)) / h
dif(h) = (f(1 + h) - f(1 - h)) / 2h
View sse2test.cpp
#include <stdio.h>
#include <random>
#include "mytimer.h"
typedef double v2df __attribute__ ((vector_size (16)));
#define N 10000000
#define AL 16
#define HNK 139079.0
View mydouble.h
#include <stdio.h>
#include <math.h>
typedef double PrimDouble;
struct MyDouble {
PrimDouble v;
static const int precision = 23;
MyDouble() { v = 0; }
View mytimer.h
#include <stdio.h>
#include <chrono>
class MyTimer {
std::chrono::system_clock::time_point s;
double ms;
public:
inline void start() {
s = std::chrono::system_clock::now();
}