Skip to content

Instantly share code, notes, and snippets.

View tmathmeyer's full-sized avatar
🤧
Achoo

Ted tmathmeyer

🤧
Achoo
  • Google
  • kirkland
View GitHub Profile
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.0/jquery.min.js"></script>
<script src="json2.js"></script>
<script type="text/javascript">
var url = "http://api.tingo.com/vanhonk";
var request = {
"jsonrpc":"2.0",
"method":"service.apply",
@tmathmeyer
tmathmeyer / gist:5698268
Created June 3, 2013 13:51
autossh install
#!/bin/bash
if [ ! $# == 2 ]; then
echo "usage autosshinstall useranme@host host-nickname"
exit
fi
ssh-keygen -t rsa
ssh-copy-id $1
APP="alias $2='ssh $1'"
BASHRC="$HOME/.bashrc"
echo $APP >> $BASHRC
@tmathmeyer
tmathmeyer / gist:5718454
Created June 6, 2013 00:32
arduino oscope
import processing.serial.*;
Serial port; // Create object from Serial class
int val; // Data received from the serial port
int[] values;
void setup()
{
size(640, 480);
// Open the port that the board is connected to and use the same speed (9600 bps)
package edu.wpi.tmathmeyer.hungry.pumpkins;
import java.util.Collection;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
package edu.wpi.tmathmeyer.hungry.pumpkins;
import java.util.Collection;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
/*******************************************************************************
* Copyright (c) 2013 Ted Meyer.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ted Meyer - being a generally kickass person
******************************************************************************/
@tmathmeyer
tmathmeyer / gist:5884634
Last active December 19, 2015 02:39
works, but takes abt 7 days
package edu.wpi.tmathmeyer.euler;
public class Problem433 {
int[][] mem = new int[50000][];
int size = 500000;
public static void main(String[] args){
new Problem433().problem();
}
package edu.wpi.tmathmeyer.euler;
public class Probs {
public static void problem30(){
int[] fives = new int[10];
for(int i = 0; i < 10; i++)
{
fives[i] = pow(i, 5);
System.out.println(fives[i]);
}
@tmathmeyer
tmathmeyer / gist:5893974
Last active December 19, 2015 03:59
fermat's theorem (doesnt work on numbers less than three), but checks all primes in O((log(n)^2)
boolean isPrime(long n)
{//fermats :D
if (n%2==0 || n%3==0)
{
return false;
}
boolean res = true;
for (long a = 2; a<n; a*=2)
{
res = res&&exp_mod_itr(a,n,n)==a;
@tmathmeyer
tmathmeyer / gist:5906083
Last active December 19, 2015 05:39
lol omesh
public class RPSGame extends JFrame implements ActionListener
{
int wins = 0;
int ties = 0;
int total = 0;
JPanel scores;
public RPSGame(String title)
{