Skip to content

Instantly share code, notes, and snippets.

azapen6 azapen6

Block or report user

Report or block azapen6

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@azapen6
azapen6 / AppOnlyAuthentication.scala
Last active Nov 19, 2018
Twitter by Okkam HTTP: Obtains a Bearer by Application Only Authentication.
View AppOnlyAuthentication.scala
import okkam.http._
import scala.io.StdIn
import scala.concurrent.Future
import scala.util.{Success, Failure}
import akka.http.scaladsl.model._
object AppOnlyAuthentication {
@azapen6
azapen6 / UserAuthentication.scala
Last active Sep 22, 2018
Twitter by Okkam HTTP: Obtains an Access Token by User Authentication.
View UserAuthentication.scala
import okkam.http._
import okkam.http.OAuth1._
import akka.http.scaladsl.model._
import scala.io.StdIn
import scala.concurrent.Future
import scala.util.{Success, Failure}
import scala.annotation.tailrec
@azapen6
azapen6 / HSLColor.scala
Last active Mar 18, 2018
Converts RGB from/to HSL
View HSLColor.scala
/**
* Converts RGB from/to HSL
*/
import java.awt.Color
import math._
/** Companion object */
object HSLColor {
@azapen6
azapen6 / Fl_create_context.cxx
Last active Dec 26, 2018
Creates an OpenGL context >= 3.3 in FLTK 1.3.4
View Fl_create_context.cxx
// This code is based on the following tips:
// https://www.khronos.org/opengl/wiki/Tutorial:_OpenGL_3.0_Context_Creation_(GLX)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <GL/gl.h>
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();
}
View bfi.plt
#bfi.plt
load "bfi_init.plt"
load "bfi_run.plt"
You can’t perform that action at this time.