Skip to content

Instantly share code, notes, and snippets.

View LuxXx's full-sized avatar

David LuxXx

View GitHub Profile
@LuxXx
LuxXx / ContinuedFractions.java
Last active May 12, 2017 14:12
A method to calculate the value of a continued fraction
public class ContinuedFractions {
public static void main(String[] args) {
double[] e_cf = {2,1,2,1,1,4,1,1,6,1,1,8,1,1,10,1,1,12,1,1,14};
System.out.println(cf(e_cf));
System.out.println(Math.E);
}
// optionally pass the index value and do not copy the tail array every time
public static double cf(double... d) {
@LuxXx
LuxXx / Decompiler.java
Created May 20, 2017 18:13
Decompiler for AutoHotKey - Written in early 2015
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@LuxXx
LuxXx / Rooting.java
Created May 27, 2017 23:00
Numerical way to do the square root
public class Rooting {
public static void main(String[] args) {
System.out.println(next(1000, 2));
System.out.println(Math.sqrt(2));
}
public static double next(int n, double r) {
if (n <= 0) return 1;
@LuxXx
LuxXx / Partition.java
Last active June 4, 2017 16:06
Riemann Integral
public class Partition {
private double a;
private double b;
private double N;
public Partition(double a, double b, double N) {
super();
this.a = a;
this.b = b;
@LuxXx
LuxXx / calcgame.js
Last active August 15, 2017 10:26
A script to find solutions to Calculator: The Game
// This is a script to find a solution to Calculator: The Game
// https://play.google.com/store/apps/details?id=com.sm.calculateme
function add(a) {
return {
apply: function(b) {
return a + b;
},
info: 'add ' + a
}
@LuxXx
LuxXx / QVMDisas
Created September 1, 2017 08:33 — forked from lrq3000/QVMDisas
QVMDisas v0.3 Python version (older than the Go version), author Macpunk
#!/usr/bin/env python
# encoding: utf-8
"""
QVMDisas.py
Created by Macpunk on 2009-09-20.
Updated by GrosBedo on 2010-04-12
Copyright (c) 2009 Dalton M. Cummings. All rights reserved.
CHANGELOG
@LuxXx
LuxXx / DiceGame.java
Created September 9, 2017 11:33
A dice game
import java.util.PriorityQueue;
public class DiceGame {
/*
* We are playing a dice game.
* Player A plays with 2 dice.
* Player B plays with 3 dice.
* Player A adds up the eyes of both rolls.
* Player B chooses the two highest and adds up these.
@LuxXx
LuxXx / mintos.js
Created November 2, 2017 11:29
Mintos Show Profit JS Script
// ==UserScript==
// @name Mintos
// @namespace Mintos
// @include https://www.mintos.com/*
// @version 1
// @grant none
// ==/UserScript==
$(document).ready(function() {
let profit = $("#mintos-boxes")[0].childNodes[1].childNodes[0].childNodes[1].childNodes[0].childNodes[5].childNodes[1].childNodes[0].data;
document.title = profit + " | " + document.title;
import random
def abschreiber(n):
ab = [0] * n
for i in range(0, n):
b = random.choice([-1, 1])
ab[(i+b) % n] += 1
ab = list(filter(lambda x: x == 0, ab))
public class WeirdEuler {
public static int N = 1000000;
public static double ak(int k) {
if (k == 0) return 2;
double product = 1;
for (int i = k; i < 2*k; i+=2) {
product *= ((double) (i+2)) / (i+1);
}