Skip to content

Instantly share code, notes, and snippets.

View Darksonn's full-sized avatar

Alice Ryhl Darksonn

View GitHub Profile
public class ModulusFinder {
public static void main(String[] args) {
int i = 0;
while (!test(i)) {
System.out.println(i++);
}
System.out.println("lowest answer: " + i);
}
static boolean test(int x) {
@Darksonn
Darksonn / BigFraction.java
Created December 13, 2013 12:41
Calculates the logarithm of an argument arguments: number [precision, default is 250] [base, default is e]
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.WeakHashMap;
/**
* Stores 2 {@link BigInteger}s, one numerator and one denominator, these two values then define a fraction.<br>
* Creating a BigFraction which has another instance with the same value somewhere else, a new one will not be created but the other value is returned.<br>
* Because of this, == can be used for comparing the fractions and yield correct results.
### Keybase proof
I hereby claim:
* I am Darksonn on github.
* I am aliceryhl (https://keybase.io/aliceryhl) on keybase.
* I have a public key whose fingerprint is 49F6 C1FA A749 60F4 3A5B 86A1 EE7A 392F DE96 209F
To claim this, I am signing this object:
function onscrollUpdateStacks(stackElems, lines) {
var i;
var stackBox = stackElems[0][0].getBoundingClientRect();
var stackMid = (stackBox.top + 3*stackBox.bottom) / 4.0;
var current = -1;
var currentY = -Infinity;
// Find the thing to highlight.
for (i = 0; i < stackElems.length; ++i) {
var divBox = stackElems[i][1].getBoundingClientRect();
@Darksonn
Darksonn / test.log
Created June 5, 2020 17:50
MacOS test #2590
2020-06-05T17:29:12.0015250Z ##[section]Starting: tokio - cargo test --all-features
2020-06-05T17:29:12.0025270Z ==============================================================================
2020-06-05T17:29:12.0025860Z Task : Command line
2020-06-05T17:29:12.0026410Z Description : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
2020-06-05T17:29:12.0026920Z Version : 2.164.2
2020-06-05T17:29:12.0027340Z Author : Microsoft Corporation
2020-06-05T17:29:12.0027870Z Help : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
2020-06-05T17:29:12.0028450Z ==============================================================================
2020-06-05T17:29:12.1545660Z Generating script.
2020-06-05T17:29:12.1567410Z Script contents:
@Darksonn
Darksonn / Cargo.toml
Last active November 10, 2022 20:49
Hyper example
[package]
name = "hyperexample"
version = "0.1.0"
authors = ["Alice Ryhl <alice@ryhl.io>"]
edition = "2018"
[dependencies]
hyper = "0.12"
hyper-tls = "0.3"
tokio = "0.1"
@Darksonn
Darksonn / compile.sh
Created February 2, 2020 08:28
Staticly link qbittorrent v4.1.9.1
#!/bin/bash
set -e
QBITTORRENT_TAG=release-4.1.9.1
LIBTORRENT_TAG=RC_1_1
QT5_TAG=5.12
BOOST_VER=1.69.0
BOOST_BUILD_TAG=boost-$BOOST_VER
rm -rf work
@Darksonn
Darksonn / killswitch.rs
Last active November 10, 2022 20:50
Kill switch for hyper sockets
#[derive(Clone)]
pub struct KillSwitch {
kill: Arc<AtomicBool>,
}
impl KillSwitch {
pub fn new() -> Self {
KillSwitch {
kill: Arc::new(AtomicBool::new(false)),
}
}