This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdint.h> | |
#include <stdlib.h> | |
#define MIN(X,Y) (((X) < (Y)) ? (X) : (Y)) | |
// used for modeling rational numbers exactly as two integers (nom/den) | |
typedef struct Ratio { | |
uint64_t den; | |
uint64_t nom; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
if [[ $UID != 0 ]]; | |
then | |
echo "Please run this script with sudo or as root:" | |
echo | |
echo "sudo $0 $*" | |
exit 1 || return 1 | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
public class Main { | |
public static void main(String[] args) { | |
int targetRows = 16; | |
int width = 16; | |
long tries = 0; | |
double bestScore = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef SDL_PROJECT_VECTOR_H | |
#define SDL_PROJECT_VECTOR_H | |
#include <iostream> | |
#include <cstdarg> | |
#include <sstream> | |
#include <cmath> | |
template <typename NumType, int N> | |
class Vector { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Javascript date timer demo</title> | |
<script type="text/javascript"> | |
var e; | |
function init() { | |
e = document.getElementById("pre"); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BigInteger sqrt(BigInteger n) { | |
BigInteger a = BigInteger.ONE; | |
BigInteger b = n.shiftRight(5).add(BigInteger.valueOf(8)); | |
while (b.compareTo(a) >= 0) { | |
BigInteger mid = a.add(b).shiftRight(1); | |
if (mid.multiply(mid).compareTo(n) > 0) { | |
b = mid.subtract(BigInteger.ONE); | |
} else { | |
a = mid.add(BigInteger.ONE); | |
} |