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
package com.test.wordcount; | |
import java.io.IOException; | |
import java.util.*; | |
import org.apache.hadoop.fs.Path; | |
import org.apache.hadoop.conf.*; | |
import org.apache.hadoop.io.*; | |
import org.apache.hadoop.mapreduce.*; | |
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat; |
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
module Main where | |
import Control.Concurrent (threadDelay) | |
import System.INotify | |
main :: IO () | |
main = do | |
-- the paths that we'll monitor | |
let paths = [ "/tmp", "/home/user" ] | |
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 Control.Monad.Reader | |
-- | Shared configuration for this application. | |
-- Rather trivial (and useless), it just configures how our application will | |
-- address the user | |
-- | |
data SalutationConfig = SalutationConfig { formal :: Bool } | |
-- | Returns a greeting | |
-- Takes in someone's name and returns a greeting string |
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 Control.Monad.Writer | |
-- | Starts a value off. | |
-- This function doesn't perform any calculation at all, it just prepares an | |
-- initial value to start in the calculation pipeline | |
-- | |
start :: Int -> Writer [String] Int | |
start x = do | |
tell (["Starting with " ++ show x]) | |
return x |
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 Control.Monad.State | |
-- | Starts a value off. | |
-- This function doesn't perform any calculation at all, it just prepares an | |
-- initial value to start in the calculation pipeline | |
-- | |
start :: Int -> State [String] Int | |
start x = do | |
put ["Starting with " ++ show x] | |
return x |
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
{-# LANGUAGE TemplateHaskell #-} | |
import Control.Lens | |
data Ball = Ball { _position :: (Double, Double), _velocity :: (Double, Double) } | |
deriving (Show) | |
-- create the accessors for the Ball type | |
makeLenses ''Ball |
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 Control.Concurrent | |
import Control.Concurrent.MVar | |
main :: IO () | |
main = do | |
-- create an empty mvar | |
m <- newEmptyMVar | |
-- get another thread to put a value in it | |
forkIO $ putMVar m "A value" |
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 <alloc.h> | |
#include <conio.h> | |
#include <stdlib.h> | |
#define VIDEO_MODE_MCGA 0x13 | |
#define VIDEO_MODE_TEXT 0x03 | |
#define PARTICLE_COUNT 1000 |
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 ruby | |
require 'base64' | |
require 'openssl' | |
common = { | |
:key_length => 4096, | |
:digest_func => OpenSSL::Digest::SHA256.new | |
} |
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 <Wire.h> | |
#include <LiquidCrystal.h> | |
#define LCD_WIDTH 16 | |
#define LCD_HEIGHT 2 | |
#define LCD_SIZE (LCD_WIDTH * LCD_HEIGHT) | |
class LCDDoubleBuffer { |
OlderNewer