Skip to content

Instantly share code, notes, and snippets.

View jmcarthur's full-sized avatar

Jake McArthur jmcarthur

  • Jersey City, NJ, USA
View GitHub Profile
#!/usr/bin/env ruby
require "net/http"
require "uri"
require "json"
require "base64"
class Imgur
API_KEY = "15a6efd29935f62ea87579a8325d945a"
import System.IO
import System.Posix
import Network
import Network.Socket hiding (accept)
import Data.List
import Control.Monad
import Control.Concurrent
import Control.Concurrent.STM
Please try to write in here
Hey look it's a new line!
@jmcarthur
jmcarthur / gist:777544
Created January 13, 2011 07:48
Tron Line of Sight
; Alice's point of view
yourbikes A
mapwidth 15
mapheight 15
map Aa..............
map a..............
map ...............
map .#............
map ..............
map ..#..........
yourbikes A
mapwidth 15
mapheight 15
map Aa..............
map a..............
map ...............
map .#............
map ..............
map ..#..........
map .............
+-------+-------+
| | |
| A1-> | <-B |
| | |
+-------+-------+
| ^ | |
| A2 | |
| | |
+-------+-------+
1. Map each ant to the number of ants it's fighting.
2. For each number, keep it only if all of its opposing neighbors are larger.
Example:
A A A -
A B C D
A1 A2 A3 --
A1 B3 C2 D1
A-A-A
-A-A-
B-B-B
-B-B-
1-1-1
-3-3-
2-3-2
-1-1-
data NumTree a b = NumNode (a, b) (Maybe [NumTree a b])
| NumNil
deriving (Eq, Show)
data Tree a = Node a (Maybe [Tree a])
| Nil
deriving (Eq, Show)
numberTree :: Tree a -> State Int (NumTree Int a)
numberTree Nil = return NumNil
# cat packages | xargs apt-get install
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following package was automatically installed and is no longer required:
libgmp3-dev
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
libgmp-dev libgmp10 libgmp3-dev libgmpxx4ldbl zlib1g-dev
Suggested packages: